Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- OdbcDataReader.cs
- TransformationRules.cs
- ObjectListComponentEditor.cs
- XmlLoader.cs
- MethodToken.cs
- VoiceSynthesis.cs
- UnsafeNativeMethods.cs
- _AuthenticationState.cs
- versioninfo.cs
- InsufficientMemoryException.cs
- QuadraticEase.cs
- FileSystemWatcher.cs
- FixedDSBuilder.cs
- FormViewAutoFormat.cs
- LocalizedNameDescriptionPair.cs
- X509Utils.cs
- XappLauncher.cs
- DataGridViewColumnStateChangedEventArgs.cs
- KnownTypes.cs
- safelinkcollection.cs
- IndexedDataBuffer.cs
- DynamicRendererThreadManager.cs
- MethodExpression.cs
- Relationship.cs
- FormsAuthenticationModule.cs
- AlternateViewCollection.cs
- SafeEventHandle.cs
- XmlSerializerFactory.cs
- MailMessageEventArgs.cs
- PaintEvent.cs
- RegexParser.cs
- SymLanguageType.cs
- MachineSettingsSection.cs
- WebHttpElement.cs
- TemplateEditingService.cs
- HtmlToClrEventProxy.cs
- GridProviderWrapper.cs
- RectConverter.cs
- PartialList.cs
- BitmapFrameDecode.cs
- CorrelationValidator.cs
- LocatorGroup.cs
- TaiwanLunisolarCalendar.cs
- WebBrowserProgressChangedEventHandler.cs
- VisemeEventArgs.cs
- ZipIOExtraFieldZip64Element.cs
- AmbiguousMatchException.cs
- SystemResourceHost.cs
- HwndMouseInputProvider.cs
- UserInitiatedRoutedEventPermission.cs
- OleDbPropertySetGuid.cs
- DetailsViewCommandEventArgs.cs
- ResourceDictionary.cs
- RegionInfo.cs
- DES.cs
- AppSettingsExpressionEditor.cs
- TabControlAutomationPeer.cs
- ButtonColumn.cs
- SoapMessage.cs
- ExpandCollapseProviderWrapper.cs
- CommandLibraryHelper.cs
- XmlElementList.cs
- COM2ExtendedUITypeEditor.cs
- ServicesUtilities.cs
- GCHandleCookieTable.cs
- Label.cs
- TransformerTypeCollection.cs
- ListCollectionView.cs
- ObjectNavigationPropertyMapping.cs
- WpfPayload.cs
- ControlBuilder.cs
- PersonalizableAttribute.cs
- TreeNodeBindingCollection.cs
- AssociationProvider.cs
- GroupDescription.cs
- Utils.cs
- StickyNoteHelper.cs
- InputQueueChannelAcceptor.cs
- DesignerAttribute.cs
- SubpageParagraph.cs
- VectorKeyFrameCollection.cs
- DurableErrorHandler.cs
- IntSecurity.cs
- LexicalChunk.cs
- HtmlElementCollection.cs
- WindowsListBox.cs
- SqlCacheDependencyDatabaseCollection.cs
- XmlSchemaException.cs
- SerializationAttributes.cs
- DataGridCell.cs
- Sequence.cs
- Sql8ConformanceChecker.cs
- webeventbuffer.cs
- Effect.cs
- DataGrid.cs
- InternalsVisibleToAttribute.cs
- XMLUtil.cs
- PenThreadWorker.cs
- ThemeDirectoryCompiler.cs
- QuaternionAnimationUsingKeyFrames.cs