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
- TextEditorSelection.cs
- ToolStripItemTextRenderEventArgs.cs
- QueryCursorEventArgs.cs
- ArrayList.cs
- TypeLoadException.cs
- oledbmetadatacolumnnames.cs
- ContentPlaceHolder.cs
- XmlWriterTraceListener.cs
- ProxyGenerationError.cs
- DescendantBaseQuery.cs
- PropertyRecord.cs
- XmlWriter.cs
- SortQuery.cs
- KnownTypesHelper.cs
- UnauthorizedWebPart.cs
- ResourceDescriptionAttribute.cs
- WeakReference.cs
- Point3DCollectionValueSerializer.cs
- SqlRewriteScalarSubqueries.cs
- AutomationIdentifierGuids.cs
- MgmtConfigurationRecord.cs
- XsltCompileContext.cs
- RightsDocument.cs
- DbConnectionPoolGroupProviderInfo.cs
- DropDownList.cs
- XPathCompileException.cs
- TransportSecurityProtocolFactory.cs
- BuiltInPermissionSets.cs
- HighlightVisual.cs
- Rect3DValueSerializer.cs
- Button.cs
- ReachNamespaceInfo.cs
- GatewayDefinition.cs
- FormViewPagerRow.cs
- Calendar.cs
- ItemType.cs
- Mutex.cs
- DataSourceNameHandler.cs
- OperationCanceledException.cs
- MergablePropertyAttribute.cs
- ToolTipService.cs
- TextUtf8RawTextWriter.cs
- DNS.cs
- ProfilePropertySettings.cs
- RuntimeHelpers.cs
- TreeView.cs
- CommentAction.cs
- XmlValueConverter.cs
- designeractionbehavior.cs
- LogicalExpr.cs
- GestureRecognizer.cs
- GeometryHitTestResult.cs
- CodePageEncoding.cs
- DBConnection.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- LoadedEvent.cs
- AppDomainCompilerProxy.cs
- CodeChecksumPragma.cs
- FormatterServices.cs
- TypeEnumerableViewSchema.cs
- PlatformNotSupportedException.cs
- ListSortDescriptionCollection.cs
- OpCodes.cs
- TransformedBitmap.cs
- PassportAuthenticationEventArgs.cs
- VerificationException.cs
- DeadCharTextComposition.cs
- PermissionToken.cs
- AffineTransform3D.cs
- SafeMILHandle.cs
- InstancePersistenceCommandException.cs
- NativeMethods.cs
- StandardMenuStripVerb.cs
- OrderedDictionary.cs
- SystemWebCachingSectionGroup.cs
- FormParameter.cs
- GifBitmapEncoder.cs
- StatusBar.cs
- RenderDataDrawingContext.cs
- PeerTransportElement.cs
- Stream.cs
- UserNameSecurityTokenProvider.cs
- WebPartActionVerb.cs
- SQLDecimal.cs
- TimeSpanConverter.cs
- AndCondition.cs
- FixUpCollection.cs
- Tuple.cs
- SinglePageViewer.cs
- AlternateViewCollection.cs
- streamingZipPartStream.cs
- MoveSizeWinEventHandler.cs
- UrlPath.cs
- XPathScanner.cs
- TableProviderWrapper.cs
- SqlCacheDependencySection.cs
- BamlMapTable.cs
- WebServiceHandlerFactory.cs
- ScrollChrome.cs
- GridSplitterAutomationPeer.cs