Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / Util / Pair.cs / 1305376 / 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
- ConfigurationConverterBase.cs
- WmlTextBoxAdapter.cs
- BindableAttribute.cs
- AbsoluteQuery.cs
- OciHandle.cs
- QuaternionAnimationUsingKeyFrames.cs
- KnownTypesHelper.cs
- FrameworkContentElement.cs
- ExtenderProvidedPropertyAttribute.cs
- CodeIndexerExpression.cs
- TextOptions.cs
- Evidence.cs
- Win32Native.cs
- SingleAnimationBase.cs
- URLBuilder.cs
- DateTimeHelper.cs
- TreeNodeBindingDepthConverter.cs
- FormatterConverter.cs
- XmlAttributeOverrides.cs
- ObjectNotFoundException.cs
- ConvertEvent.cs
- WmpBitmapEncoder.cs
- XmlSchemaAnnotated.cs
- Brush.cs
- CorePropertiesFilter.cs
- ConfigurationConverterBase.cs
- CompareInfo.cs
- ClientTarget.cs
- WindowsSysHeader.cs
- Material.cs
- ReadOnlyTernaryTree.cs
- ApplicationSecurityManager.cs
- Pkcs9Attribute.cs
- KnownBoxes.cs
- EventDescriptorCollection.cs
- FileLogRecordHeader.cs
- XNodeNavigator.cs
- WebAdminConfigurationHelper.cs
- FormsAuthenticationEventArgs.cs
- PickDesigner.xaml.cs
- ZoneMembershipCondition.cs
- Pair.cs
- Mutex.cs
- ObjectIDGenerator.cs
- ImageBrush.cs
- SourceFileBuildProvider.cs
- FlowDocumentPage.cs
- ResourcePermissionBase.cs
- SoapEnumAttribute.cs
- SimpleType.cs
- SerializationInfoEnumerator.cs
- OutputCacheSection.cs
- RectangleConverter.cs
- QueryTask.cs
- XmlSchemaGroupRef.cs
- ContractCodeDomInfo.cs
- HyperLink.cs
- AggregationMinMaxHelpers.cs
- CssTextWriter.cs
- Command.cs
- ObjectDataSourceChooseMethodsPanel.cs
- TextAutomationPeer.cs
- DefaultBinder.cs
- FixedTextSelectionProcessor.cs
- CollectionType.cs
- SiteOfOriginPart.cs
- XmlAttributeCollection.cs
- SecurityHelper.cs
- DefaultValueAttribute.cs
- HttpWriter.cs
- ToolStripSeparator.cs
- ToolStripProgressBar.cs
- TdsParserSessionPool.cs
- ParameterReplacerVisitor.cs
- DataBoundControl.cs
- SymmetricKey.cs
- UnauthorizedWebPart.cs
- Stack.cs
- SoapParser.cs
- NotCondition.cs
- MaskedTextBoxTextEditor.cs
- InvokeGenerator.cs
- HttpPostProtocolReflector.cs
- ToolStripProgressBar.cs
- DependencyObject.cs
- X509Chain.cs
- TimeIntervalCollection.cs
- ParserStreamGeometryContext.cs
- GridViewHeaderRowPresenter.cs
- ByteStreamMessageEncoder.cs
- EntityDataSourceChangedEventArgs.cs
- DirectoryInfo.cs
- DateTimeUtil.cs
- DesignerSerializerAttribute.cs
- DataGridViewDataConnection.cs
- VoiceInfo.cs
- ApplicationManager.cs
- TypedCompletedAsyncResult.cs
- Process.cs
- ManagementEventArgs.cs