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
- WebRequestModuleElement.cs
- LineSegment.cs
- CompilerGlobalScopeAttribute.cs
- ListControlBuilder.cs
- SuppressedPackageProperties.cs
- XmlArrayItemAttributes.cs
- TimeIntervalCollection.cs
- EditorPart.cs
- ScrollItemPattern.cs
- ArglessEventHandlerProxy.cs
- DashStyles.cs
- WebRequestModuleElement.cs
- GridProviderWrapper.cs
- DragDropManager.cs
- Nullable.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- ServiceOperationWrapper.cs
- SchemaAttDef.cs
- HMACSHA384.cs
- ExpressionsCollectionConverter.cs
- DataGridViewColumnCollection.cs
- RequestCachePolicy.cs
- TextParaClient.cs
- _BasicClient.cs
- PartitionResolver.cs
- UniformGrid.cs
- UniqueConstraint.cs
- PartBasedPackageProperties.cs
- DesignBindingConverter.cs
- NativeCompoundFileAPIs.cs
- EntityWrapperFactory.cs
- CreateSequenceResponse.cs
- DecimalFormatter.cs
- XmlJsonWriter.cs
- XmlSchemaNotation.cs
- PolyLineSegment.cs
- DataKeyArray.cs
- ObjectMemberMapping.cs
- QueryContinueDragEvent.cs
- RootBrowserWindowAutomationPeer.cs
- PrivateFontCollection.cs
- HwndSource.cs
- GenericUriParser.cs
- AudioException.cs
- HandlerWithFactory.cs
- DBAsyncResult.cs
- KeyValuePairs.cs
- RefExpr.cs
- GroupAggregateExpr.cs
- DesignerTransactionCloseEvent.cs
- DataSourceCache.cs
- RequestValidator.cs
- StandardTransformFactory.cs
- BitmapEffectInput.cs
- BatchServiceHost.cs
- XmlElement.cs
- Page.cs
- HttpCookieCollection.cs
- CollectionView.cs
- DbParameterCollection.cs
- PathFigureCollection.cs
- XpsInterleavingPolicy.cs
- WorkflowApplicationCompletedException.cs
- XmlNamespaceMappingCollection.cs
- PermissionSetTriple.cs
- ZipArchive.cs
- DocumentApplicationDocumentViewer.cs
- DefinitionBase.cs
- CopyAttributesAction.cs
- Utility.cs
- WindowsToolbarAsMenu.cs
- InputReportEventArgs.cs
- LinearKeyFrames.cs
- RootBrowserWindowProxy.cs
- MenuItemBinding.cs
- SHA512.cs
- AnnotationMap.cs
- ProfileSettings.cs
- DateTimeOffset.cs
- RadioButtonFlatAdapter.cs
- TraceHandlerErrorFormatter.cs
- StorageSetMapping.cs
- SortedDictionary.cs
- OdbcConnectionOpen.cs
- AssociationEndMember.cs
- Char.cs
- ExportOptions.cs
- CodeDOMProvider.cs
- PersonalizableTypeEntry.cs
- EnumerableCollectionView.cs
- UxThemeWrapper.cs
- BoundsDrawingContextWalker.cs
- ConstraintCollection.cs
- SplineKeyFrames.cs
- ExtendedPropertyDescriptor.cs
- ControlCachePolicy.cs
- CommonObjectSecurity.cs
- DetailsViewDeletedEventArgs.cs
- WindowsIPAddress.cs
- IRCollection.cs