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
- CheckBoxStandardAdapter.cs
- IgnoreFileBuildProvider.cs
- DataFormats.cs
- NCryptNative.cs
- unsafenativemethodsother.cs
- WinFormsSecurity.cs
- DefaultBinder.cs
- IPEndPoint.cs
- CodeLabeledStatement.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- SimpleBitVector32.cs
- ServiceDescriptionSerializer.cs
- CmsUtils.cs
- GenericRootAutomationPeer.cs
- ButtonBase.cs
- ResourceSetExpression.cs
- AppliedDeviceFiltersDialog.cs
- SqlDataSource.cs
- DesignerTransaction.cs
- ViewBase.cs
- LoggedException.cs
- WriterOutput.cs
- _NegoStream.cs
- Propagator.cs
- ResourceAttributes.cs
- sqlser.cs
- PrivacyNoticeElement.cs
- XmlSerializableReader.cs
- NativeMethods.cs
- ListItemsPage.cs
- SchemaCollectionPreprocessor.cs
- recordstate.cs
- ClientSettings.cs
- IntSecurity.cs
- UInt16.cs
- SqlRowUpdatedEvent.cs
- validation.cs
- BigInt.cs
- Int32CollectionConverter.cs
- PrintDialog.cs
- RoutedEventHandlerInfo.cs
- DataStreams.cs
- AutomationAttributeInfo.cs
- BeginEvent.cs
- AdjustableArrowCap.cs
- PlanCompiler.cs
- SizeLimitedCache.cs
- ConfigDefinitionUpdates.cs
- Int32Collection.cs
- RecognizedAudio.cs
- WebBrowserProgressChangedEventHandler.cs
- COM2EnumConverter.cs
- FixedPage.cs
- BindStream.cs
- Debugger.cs
- LiteralLink.cs
- HttpRawResponse.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- TimerEventSubscriptionCollection.cs
- HttpFileCollection.cs
- WebRequestModuleElementCollection.cs
- PageTheme.cs
- WebServiceTypeData.cs
- SmtpFailedRecipientException.cs
- SoapObjectInfo.cs
- OutputCacheProfile.cs
- BlurBitmapEffect.cs
- TableLayoutPanelCodeDomSerializer.cs
- ListSortDescriptionCollection.cs
- CodeAttributeArgument.cs
- webproxy.cs
- XmlBoundElement.cs
- StorageInfo.cs
- SqlAliasesReferenced.cs
- LogRecordSequence.cs
- WindowCollection.cs
- CustomTrackingRecord.cs
- _LazyAsyncResult.cs
- SignatureDescription.cs
- SubMenuStyleCollection.cs
- ByteAnimationUsingKeyFrames.cs
- XmlSerializationGeneratedCode.cs
- DataGridPagerStyle.cs
- SignedXml.cs
- RadioButtonStandardAdapter.cs
- CustomAttribute.cs
- ResponseStream.cs
- RoleBoolean.cs
- TypeForwardedToAttribute.cs
- DesignerTextViewAdapter.cs
- MemoryStream.cs
- MdiWindowListStrip.cs
- RectValueSerializer.cs
- Tool.cs
- ThumbButtonInfo.cs
- AdornerHitTestResult.cs
- NetStream.cs
- ConfigurationManagerHelper.cs
- TableRowGroup.cs
- DbParameterCollectionHelper.cs