Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Common / Utils / Pair.cs / 1305376 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ListBoxChrome.cs
- AbandonedMutexException.cs
- AddingNewEventArgs.cs
- X509Chain.cs
- ModelUIElement3D.cs
- CodeExpressionStatement.cs
- QueryReaderSettings.cs
- COM2PropertyDescriptor.cs
- StoreAnnotationsMap.cs
- SingleAnimation.cs
- IUnknownConstantAttribute.cs
- Image.cs
- XmlSchemaValidator.cs
- ProcessThread.cs
- Slider.cs
- NavigationEventArgs.cs
- EntityDataSourceColumn.cs
- PropertyDescriptorGridEntry.cs
- ByteAnimation.cs
- dataSvcMapFileLoader.cs
- SuppressMergeCheckAttribute.cs
- HttpWebRequest.cs
- ConstructorBuilder.cs
- StatusBarItem.cs
- ErrorWrapper.cs
- PathStreamGeometryContext.cs
- SqlGatherConsumedAliases.cs
- CreateUserErrorEventArgs.cs
- DictionaryCustomTypeDescriptor.cs
- SpellCheck.cs
- DrawingContext.cs
- PropertyChangingEventArgs.cs
- TemplateXamlParser.cs
- ProviderConnectionPointCollection.cs
- LeaseManager.cs
- ThreadAbortException.cs
- NavigationPropertyEmitter.cs
- CommandSet.cs
- TerminateSequence.cs
- UInt64Storage.cs
- ADMembershipProvider.cs
- _ServiceNameStore.cs
- StrokeFIndices.cs
- TemplatePagerField.cs
- TransformProviderWrapper.cs
- AnimationLayer.cs
- TextElementAutomationPeer.cs
- BufferModeSettings.cs
- RecognitionEventArgs.cs
- OverflowException.cs
- MaterialGroup.cs
- NativeMethods.cs
- CacheChildrenQuery.cs
- TextDecoration.cs
- ValueTable.cs
- AnnotationComponentManager.cs
- WindowsStatic.cs
- CustomAttribute.cs
- OrderToken.cs
- InvalidEnumArgumentException.cs
- ColumnWidthChangingEvent.cs
- ColorAnimation.cs
- Matrix.cs
- HitTestDrawingContextWalker.cs
- WebPartDisplayModeCancelEventArgs.cs
- ClonableStack.cs
- CurrencyWrapper.cs
- FixedSOMFixedBlock.cs
- BitmapEffectState.cs
- TextRenderer.cs
- StoreItemCollection.Loader.cs
- KnownAssemblyEntry.cs
- DbMetaDataFactory.cs
- RadioButton.cs
- SqlXml.cs
- CompilerWrapper.cs
- DocumentAutomationPeer.cs
- ListControlStringCollectionEditor.cs
- smtpconnection.cs
- CollectionView.cs
- WindowsListViewGroupSubsetLink.cs
- KeyFrames.cs
- EditorPartChrome.cs
- DescriptionCreator.cs
- NetStream.cs
- Internal.cs
- MetadataCache.cs
- NetMsmqBinding.cs
- TextBounds.cs
- CodeAccessSecurityEngine.cs
- httpserverutility.cs
- LocalizationParserHooks.cs
- ClientCultureInfo.cs
- XmlCharacterData.cs
- CommandPlan.cs
- MasterPageParser.cs
- DocumentXmlWriter.cs
- WebColorConverter.cs
- PreservationFileReader.cs
- ProviderConnectionPointCollection.cs