Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / xsp / System / Web / Extensions / Util / Pair.cs / 1 / Pair.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.Util {
using System;
// Generic Pair class. Overrides Equals() and GetHashCode(), so it can be used as a dictionary key.
internal sealed class Pair {
private readonly TFirst _first;
private readonly TSecond _second;
public Pair(TFirst first, TSecond second) {
_first = first;
_second = second;
}
public TFirst First {
get {
return _first;
}
}
public TSecond Second {
get {
return _second;
}
}
public override bool Equals(object obj) {
if (obj == this) {
return true;
}
Pair other = obj as Pair;
return (other != null) &&
(((other._first == null) && (_first == null)) ||
((other._first != null) && other._first.Equals(_first))) &&
(((other._second == null) && (_second == null)) ||
((other._second != null) && other._second.Equals(_second)));
}
public override int GetHashCode() {
int a = (_first == null) ? 0 : _first.GetHashCode();
int b = (_second == null) ? 0 : _second.GetHashCode();
return HashCodeCombiner.CombineHashCodes(a, b);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.Util {
using System;
// Generic Pair class. Overrides Equals() and GetHashCode(), so it can be used as a dictionary key.
internal sealed class Pair {
private readonly TFirst _first;
private readonly TSecond _second;
public Pair(TFirst first, TSecond second) {
_first = first;
_second = second;
}
public TFirst First {
get {
return _first;
}
}
public TSecond Second {
get {
return _second;
}
}
public override bool Equals(object obj) {
if (obj == this) {
return true;
}
Pair other = obj as Pair;
return (other != null) &&
(((other._first == null) && (_first == null)) ||
((other._first != null) && other._first.Equals(_first))) &&
(((other._second == null) && (_second == null)) ||
((other._second != null) && other._second.Equals(_second)));
}
public override int GetHashCode() {
int a = (_first == null) ? 0 : _first.GetHashCode();
int b = (_second == null) ? 0 : _second.GetHashCode();
return HashCodeCombiner.CombineHashCodes(a, b);
}
}
}
// 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
- HyperLinkField.cs
- SecurityToken.cs
- TextTreeTextElementNode.cs
- AuthorizationRule.cs
- Rotation3DAnimation.cs
- RealizationDrawingContextWalker.cs
- WebGetAttribute.cs
- FastEncoder.cs
- DllNotFoundException.cs
- Win32NamedPipes.cs
- InstallerTypeAttribute.cs
- WindowsPrincipal.cs
- GB18030Encoding.cs
- VectorValueSerializer.cs
- MenuTracker.cs
- DetailsViewDeletedEventArgs.cs
- SymLanguageVendor.cs
- XmlSchemaAttributeGroup.cs
- FileLoadException.cs
- Base64Decoder.cs
- RelativeSource.cs
- ViewStateException.cs
- WhitespaceRuleReader.cs
- ByteKeyFrameCollection.cs
- XmlValidatingReaderImpl.cs
- Visual3D.cs
- UTF7Encoding.cs
- BinHexDecoder.cs
- Queue.cs
- WsatAdminException.cs
- ObjectStateFormatter.cs
- CustomCredentialPolicy.cs
- ManifestResourceInfo.cs
- DaylightTime.cs
- AspCompat.cs
- MatrixStack.cs
- EventLogPermissionEntry.cs
- UdpTransportBindingElement.cs
- FormsAuthenticationUser.cs
- WebRequestModuleElementCollection.cs
- WeakEventManager.cs
- RowToParametersTransformer.cs
- ObjectView.cs
- RemotingException.cs
- ServiceHttpModule.cs
- Form.cs
- AdRotator.cs
- TextElementCollection.cs
- EditCommandColumn.cs
- BooleanToVisibilityConverter.cs
- XamlPointCollectionSerializer.cs
- InputManager.cs
- InvalidComObjectException.cs
- HttpGetProtocolReflector.cs
- MultiTrigger.cs
- WindowInteropHelper.cs
- RectIndependentAnimationStorage.cs
- SmtpClient.cs
- RadioButton.cs
- DocumentGridPage.cs
- ItemCheckEvent.cs
- DesigntimeLicenseContextSerializer.cs
- StylusCaptureWithinProperty.cs
- SchemaHelper.cs
- DbProviderServices.cs
- DesignerWidgets.cs
- FrameworkRichTextComposition.cs
- SchemaRegistration.cs
- COM2ExtendedTypeConverter.cs
- Bookmark.cs
- SecuritySessionClientSettings.cs
- QueryTreeBuilder.cs
- LabelLiteral.cs
- EntityType.cs
- EntityProviderFactory.cs
- BulletedList.cs
- WebPartMenuStyle.cs
- SafeProcessHandle.cs
- AvTrace.cs
- WorkflowServiceHostFactory.cs
- DeferredTextReference.cs
- ExpandedWrapper.cs
- DefaultMergeHelper.cs
- MSAANativeProvider.cs
- DictionaryTraceRecord.cs
- ActivityDesignerHelper.cs
- SmiMetaData.cs
- NativeCppClassAttribute.cs
- Maps.cs
- _NetworkingPerfCounters.cs
- PropertyItemInternal.cs
- VisualStyleElement.cs
- ModelVisual3D.cs
- UnescapedXmlDiagnosticData.cs
- DataBindEngine.cs
- FunctionImportElement.cs
- ViewPort3D.cs
- SqlInternalConnectionTds.cs
- LocationSectionRecord.cs
- ResourceCodeDomSerializer.cs