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
- GenericUriParser.cs
- FocusChangedEventArgs.cs
- InstanceDataCollectionCollection.cs
- XmlSchemaAny.cs
- Constants.cs
- Content.cs
- LiteralControl.cs
- DispatcherEventArgs.cs
- SafeNativeMethods.cs
- ExpressionEditorAttribute.cs
- FrameworkObject.cs
- PathSegmentCollection.cs
- MSAANativeProvider.cs
- _NegotiateClient.cs
- BamlBinaryWriter.cs
- TableRowGroup.cs
- MetabaseSettings.cs
- ProfileSettings.cs
- ObjectStateManager.cs
- AlternateViewCollection.cs
- FixedStringLookup.cs
- NativeCppClassAttribute.cs
- Light.cs
- UnsafeNativeMethods.cs
- ValidateNames.cs
- WebMessageFormatHelper.cs
- DrawingGroupDrawingContext.cs
- ColumnClickEvent.cs
- SqlClientWrapperSmiStreamChars.cs
- HoistedLocals.cs
- ResetableIterator.cs
- SmiEventStream.cs
- DataObjectPastingEventArgs.cs
- PageAsyncTaskManager.cs
- xamlnodes.cs
- BitmapEffectCollection.cs
- ComplexLine.cs
- EqualityComparer.cs
- ValueSerializerAttribute.cs
- DBNull.cs
- FormViewUpdatedEventArgs.cs
- BindingCompleteEventArgs.cs
- ObjectDataSource.cs
- mongolianshape.cs
- TemplateKeyConverter.cs
- ListBindingConverter.cs
- InputManager.cs
- BrowserCapabilitiesFactory.cs
- ClientConvert.cs
- QilStrConcat.cs
- CodeDomExtensionMethods.cs
- DataServiceKeyAttribute.cs
- FigureHelper.cs
- Label.cs
- CustomPopupPlacement.cs
- ITextView.cs
- OuterGlowBitmapEffect.cs
- Window.cs
- EncoderParameter.cs
- DataViewListener.cs
- CompleteWizardStep.cs
- Monitor.cs
- ProtectedConfigurationProviderCollection.cs
- EdmSchemaError.cs
- VisualTreeHelper.cs
- EpmSyndicationContentSerializer.cs
- X509Logo.cs
- XmlFormatWriterGenerator.cs
- CalendarSelectionChangedEventArgs.cs
- TypeConverterAttribute.cs
- Size.cs
- OdbcInfoMessageEvent.cs
- KeyNotFoundException.cs
- VBCodeProvider.cs
- FixedPageStructure.cs
- StylusDevice.cs
- IApplicationTrustManager.cs
- COSERVERINFO.cs
- GraphicsPath.cs
- ELinqQueryState.cs
- Pair.cs
- TabItem.cs
- DocumentScope.cs
- Int32Animation.cs
- UserControlBuildProvider.cs
- ComNativeDescriptor.cs
- DigitShape.cs
- DbQueryCommandTree.cs
- UnsafeNativeMethods.cs
- FrameworkTemplate.cs
- Mappings.cs
- Int64AnimationUsingKeyFrames.cs
- UnsafeNativeMethods.cs
- ApplicationFileCodeDomTreeGenerator.cs
- RoutedUICommand.cs
- RepeatBehavior.cs
- FileFormatException.cs
- CheckBox.cs
- URI.cs
- ImmutableAssemblyCacheEntry.cs