Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / Common / Utils / Pair.cs / 1 / Pair.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.Linq; namespace System.Data.Common.Utils { internal class Pair: InternalBase { #region Fields private readonly TFirst first; private readonly TSecond second; #endregion #region Constructor internal Pair(TFirst first, TSecond second) { this.first = first; this.second = second; } #endregion #region Properties internal TFirst First { get { return first; } } internal TSecond Second { get { return second; } } #endregion #region Methods public override int GetHashCode() { return (first.GetHashCode()<<5) ^ second.GetHashCode(); } public bool Equals(Pair other) { return first.Equals(other.first) && second.Equals(other.second); } public override bool Equals(object other) { Pair otherPair = other as Pair ; return (otherPair != null && Equals(otherPair)); } #endregion #region InternalBase internal override void ToCompactString(StringBuilder builder) { builder.Append("<"); builder.Append(first.ToString()); builder.Append(", "+second.ToString()); builder.Append(">"); } #endregion internal class PairComparer : IEqualityComparer > { private PairComparer() { } internal static readonly PairComparer Instance = new PairComparer(); private static readonly EqualityComparer firstComparer = EqualityComparer .Default; private static readonly EqualityComparer secondComparer = EqualityComparer .Default; public bool Equals(Pair x, Pair y) { return firstComparer.Equals(x.First, y.First) && secondComparer.Equals(x.Second, y.Second); } public int GetHashCode(Pair source) { return source.GetHashCode(); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.Linq; namespace System.Data.Common.Utils { internal class Pair: InternalBase { #region Fields private readonly TFirst first; private readonly TSecond second; #endregion #region Constructor internal Pair(TFirst first, TSecond second) { this.first = first; this.second = second; } #endregion #region Properties internal TFirst First { get { return first; } } internal TSecond Second { get { return second; } } #endregion #region Methods public override int GetHashCode() { return (first.GetHashCode()<<5) ^ second.GetHashCode(); } public bool Equals(Pair other) { return first.Equals(other.first) && second.Equals(other.second); } public override bool Equals(object other) { Pair otherPair = other as Pair ; return (otherPair != null && Equals(otherPair)); } #endregion #region InternalBase internal override void ToCompactString(StringBuilder builder) { builder.Append("<"); builder.Append(first.ToString()); builder.Append(", "+second.ToString()); builder.Append(">"); } #endregion internal class PairComparer : IEqualityComparer > { private PairComparer() { } internal static readonly PairComparer Instance = new PairComparer(); private static readonly EqualityComparer firstComparer = EqualityComparer .Default; private static readonly EqualityComparer secondComparer = EqualityComparer .Default; public bool Equals(Pair x, Pair y) { return firstComparer.Equals(x.First, y.First) && secondComparer.Equals(x.Second, y.Second); } public int GetHashCode(Pair source) { return source.GetHashCode(); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SiteMapPath.cs
- GroupBoxRenderer.cs
- ProxyWebPart.cs
- PointUtil.cs
- LoginUtil.cs
- ExtendedPropertyDescriptor.cs
- StringBuilder.cs
- ValueTypeFixupInfo.cs
- DeflateStream.cs
- NonVisualControlAttribute.cs
- SimpleApplicationHost.cs
- Color.cs
- OpCodes.cs
- DbConnectionPoolGroupProviderInfo.cs
- ChangeNode.cs
- HtmlElementErrorEventArgs.cs
- TemplateControlCodeDomTreeGenerator.cs
- ConfigXmlElement.cs
- SqlDataSourceDesigner.cs
- TogglePattern.cs
- JapaneseCalendar.cs
- XmlSchemaSimpleTypeRestriction.cs
- CompiledIdentityConstraint.cs
- DataSetUtil.cs
- SchemaObjectWriter.cs
- DataGridColumnHeadersPresenter.cs
- WaitHandleCannotBeOpenedException.cs
- PersonalizationEntry.cs
- ViewBase.cs
- TransactionContext.cs
- returneventsaver.cs
- XmlEventCache.cs
- WsatAdminException.cs
- FixedSOMContainer.cs
- ContentElementAutomationPeer.cs
- XmlLinkedNode.cs
- ProxyBuilder.cs
- TraceLog.cs
- WorkflowDefinitionDispenser.cs
- ClientScriptManagerWrapper.cs
- MoveSizeWinEventHandler.cs
- ConfigXmlSignificantWhitespace.cs
- DataRowView.cs
- MsmqHostedTransportManager.cs
- ToolBarButtonClickEvent.cs
- RuntimeWrappedException.cs
- RequiredFieldValidator.cs
- Utils.cs
- ColorConvertedBitmap.cs
- IOException.cs
- SelectionItemPatternIdentifiers.cs
- IMembershipProvider.cs
- BitmapEffectOutputConnector.cs
- XPathPatternParser.cs
- HyperLinkField.cs
- URI.cs
- XmlReturnWriter.cs
- Keyboard.cs
- StyleSelector.cs
- PublishLicense.cs
- TargetInvocationException.cs
- PkcsUtils.cs
- SiteMapNodeItem.cs
- SafeViewOfFileHandle.cs
- WindowsGrip.cs
- XmlValidatingReaderImpl.cs
- OperationPickerDialog.designer.cs
- MetadataCollection.cs
- ChangeBlockUndoRecord.cs
- SqlExpressionNullability.cs
- dbdatarecord.cs
- SpellerInterop.cs
- AnnotationResource.cs
- ServiceModelReg.cs
- MetadataException.cs
- StateMachineExecutionState.cs
- PreloadHost.cs
- BitmapEffectInput.cs
- SetterBaseCollection.cs
- FileVersionInfo.cs
- PipeSecurity.cs
- EdmRelationshipRoleAttribute.cs
- DbXmlEnabledProviderManifest.cs
- RequestedSignatureDialog.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- FixedHyperLink.cs
- QilReplaceVisitor.cs
- ToolStripSettings.cs
- XmlBoundElement.cs
- LogReserveAndAppendState.cs
- CaseCqlBlock.cs
- MultiSelector.cs
- KoreanCalendar.cs
- UniqueConstraint.cs
- SafeBitVector32.cs
- CodeIdentifier.cs
- DirectoryLocalQuery.cs
- ImmutableCommunicationTimeouts.cs
- HostedElements.cs
- DataListItemEventArgs.cs