Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / xsp / System / Web / Extensions / Util / Pair.cs / 2 / 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
- VisualBasicValue.cs
- KerberosReceiverSecurityToken.cs
- AsyncCompletedEventArgs.cs
- AnimatedTypeHelpers.cs
- DataColumnMappingCollection.cs
- ColumnResult.cs
- CatalogZoneBase.cs
- StringResourceManager.cs
- UnknownBitmapEncoder.cs
- CreateUserWizardStep.cs
- DescendantBaseQuery.cs
- Guid.cs
- PackagingUtilities.cs
- CacheAxisQuery.cs
- SafeEventHandle.cs
- ISAPIWorkerRequest.cs
- LineBreak.cs
- SecurityDescriptor.cs
- InputReportEventArgs.cs
- SqlBooleanizer.cs
- NameSpaceExtractor.cs
- RequiredAttributeAttribute.cs
- PerformanceCounterManager.cs
- HtmlProps.cs
- TableSectionStyle.cs
- MenuTracker.cs
- WmpBitmapEncoder.cs
- DateTimeValueSerializer.cs
- CultureMapper.cs
- DetectEofStream.cs
- PromptStyle.cs
- SslStream.cs
- APCustomTypeDescriptor.cs
- AppModelKnownContentFactory.cs
- AccessorTable.cs
- Button.cs
- OutputCacheModule.cs
- RouteValueDictionary.cs
- SpotLight.cs
- WindowCollection.cs
- TemplateContentLoader.cs
- DispatcherEventArgs.cs
- ThreadExceptionDialog.cs
- DataGridSortingEventArgs.cs
- PolyBezierSegmentFigureLogic.cs
- StoreConnection.cs
- DrawingGroup.cs
- RelationshipEndCollection.cs
- DeleteMemberBinder.cs
- DataSourceProvider.cs
- ListBoxItemWrapperAutomationPeer.cs
- DbReferenceCollection.cs
- DesignerActionHeaderItem.cs
- XmlQueryContext.cs
- ExternalCalls.cs
- TagMapInfo.cs
- EntityDesignerDataSourceView.cs
- SchemaElementLookUpTable.cs
- ArgumentNullException.cs
- FaultException.cs
- RowCache.cs
- TextModifierScope.cs
- Collection.cs
- DispatcherSynchronizationContext.cs
- SessionPageStatePersister.cs
- RuntimeConfigLKG.cs
- ContentElement.cs
- RequestCacheEntry.cs
- CompModSwitches.cs
- SocketException.cs
- WebPartZoneCollection.cs
- Point.cs
- RootBrowserWindow.cs
- AdapterUtil.cs
- StructuralType.cs
- CodeBlockBuilder.cs
- JoinCqlBlock.cs
- DetailsViewInsertEventArgs.cs
- ThreadExceptionEvent.cs
- WebEvents.cs
- DuplexChannelFactory.cs
- GridSplitter.cs
- ReceiveContext.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- UshortList2.cs
- cookieexception.cs
- Sql8ExpressionRewriter.cs
- WindowsListBox.cs
- PerformanceCounters.cs
- FontStyles.cs
- DbDataRecord.cs
- ProfileSection.cs
- ToolTipService.cs
- PersonalizationState.cs
- XmlCharacterData.cs
- ServiceEndpointElement.cs
- IPGlobalProperties.cs
- GeneralTransform2DTo3D.cs
- ModelPropertyImpl.cs
- CompatibleComparer.cs