Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Shared / MS / Internal / Pair.cs / 1305600 / Pair.cs
//----------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Description: Pair class is useful when one needs to treat a pair of objects as a singly key in a collection.
//
//
// History:
// 08/04/2005 : mleonov - Created
//
//---------------------------------------------------------------------------
using System;
using System.Diagnostics;
namespace MS.Internal
{
///
/// Pair class is useful when one needs to treat a pair of objects as a singly key in a collection.
/// Apart from providing storage and accessors, the class forwards GetHashCode and Equals to the contained objects.
/// Both object are allowed to be null.
///
internal class Pair
{
public Pair(object first, object second)
{
_first = first;
_second = second;
}
public object First { get { return _first; } }
public object Second { get { return _second; } }
public override int GetHashCode()
{
return (_first == null ? 0 : _first.GetHashCode()) ^ (_second == null ? 0 : _second.GetHashCode());
}
public override bool Equals(object o)
{
Pair other = o as Pair;
return other != null &&
(_first != null ? _first.Equals(other._first) : other._first == null) &&
(_second != null ? _second.Equals(other._second) : other._second == null);
}
private object _first;
private object _second;
}
}
// 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
- ClipboardData.cs
- CommandExpr.cs
- LexicalChunk.cs
- UrlAuthorizationModule.cs
- DataRelation.cs
- ThreadInterruptedException.cs
- BuildResult.cs
- Number.cs
- ScrollProviderWrapper.cs
- RegisteredArrayDeclaration.cs
- FilterEventArgs.cs
- Rotation3DKeyFrameCollection.cs
- TimeSpanMinutesConverter.cs
- ExpressionUtilities.cs
- UserUseLicenseDictionaryLoader.cs
- FamilyCollection.cs
- CompatibleComparer.cs
- GPRECTF.cs
- SendMailErrorEventArgs.cs
- GroupQuery.cs
- MasterPageBuildProvider.cs
- UserControlParser.cs
- FrameworkRichTextComposition.cs
- DiscardableAttribute.cs
- IpcServerChannel.cs
- NameNode.cs
- ComponentCommands.cs
- cookieexception.cs
- PolicyManager.cs
- InputLanguageCollection.cs
- MimeTypeMapper.cs
- SHA512.cs
- TextRunProperties.cs
- Parallel.cs
- StatusBarItem.cs
- Token.cs
- CqlWriter.cs
- ToolStripContentPanelRenderEventArgs.cs
- XamlSerializer.cs
- DynamicEndpoint.cs
- StreamReader.cs
- ToolStripPanel.cs
- HtmlTableCellCollection.cs
- ObjectDataSource.cs
- DynamicDataResources.Designer.cs
- PageAsyncTaskManager.cs
- RowCache.cs
- TransactionFlowAttribute.cs
- DPTypeDescriptorContext.cs
- EntityCommandExecutionException.cs
- AdPostCacheSubstitution.cs
- PagePropertiesChangingEventArgs.cs
- HttpAsyncResult.cs
- RepeaterCommandEventArgs.cs
- PageAction.cs
- CodeAccessSecurityEngine.cs
- HttpsChannelFactory.cs
- MetaColumn.cs
- FixedTextView.cs
- ZoneButton.cs
- Classification.cs
- TextEditorTyping.cs
- DataKeyArray.cs
- TableCellCollection.cs
- SQLDateTime.cs
- CompiledIdentityConstraint.cs
- DirectoryInfo.cs
- CollaborationHelperFunctions.cs
- BaseAddressElement.cs
- VSWCFServiceContractGenerator.cs
- DelegatingTypeDescriptionProvider.cs
- HashSet.cs
- ImmutableObjectAttribute.cs
- WebPartVerbsEventArgs.cs
- AudioStateChangedEventArgs.cs
- infer.cs
- WebScriptMetadataInstanceContextProvider.cs
- OutOfProcStateClientManager.cs
- DataKeyArray.cs
- SchemaMerger.cs
- RegexBoyerMoore.cs
- StringOutput.cs
- WebPartZoneDesigner.cs
- CriticalHandle.cs
- MetabaseSettings.cs
- DataDesignUtil.cs
- HttpModuleCollection.cs
- Bitmap.cs
- LiteralControl.cs
- ZoneLinkButton.cs
- Html32TextWriter.cs
- SectionUpdates.cs
- _ConnectOverlappedAsyncResult.cs
- TrackPoint.cs
- PostBackOptions.cs
- Calendar.cs
- SortQuery.cs
- AuthenticationService.cs
- ClientSession.cs
- RTLAwareMessageBox.cs