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
- TextEditorMouse.cs
- XmlDataLoader.cs
- ParameterDataSourceExpression.cs
- WebPartMenuStyle.cs
- ImageBrush.cs
- ItemsPanelTemplate.cs
- Point3DAnimationBase.cs
- ImageDrawing.cs
- EntityTemplateFactory.cs
- CollectionMarkupSerializer.cs
- ThrowHelper.cs
- TraceFilter.cs
- IItemProperties.cs
- TextElementAutomationPeer.cs
- NavigationHelper.cs
- Int64KeyFrameCollection.cs
- TreeNodeCollection.cs
- AngleUtil.cs
- FixedSOMTextRun.cs
- StreamWriter.cs
- Ray3DHitTestResult.cs
- MbpInfo.cs
- LockedAssemblyCache.cs
- DbTransaction.cs
- BindValidator.cs
- ListView.cs
- TypeSystem.cs
- Expression.cs
- OrthographicCamera.cs
- DSACryptoServiceProvider.cs
- CursorConverter.cs
- WindowsIdentity.cs
- HttpCachePolicy.cs
- FixedTextSelectionProcessor.cs
- DataGridAutomationPeer.cs
- PlacementWorkspace.cs
- DataPagerFieldCollection.cs
- ConfigXmlText.cs
- CodeCommentStatementCollection.cs
- OrderedDictionaryStateHelper.cs
- Imaging.cs
- NonClientArea.cs
- TraceContextEventArgs.cs
- XmlIlVisitor.cs
- BitmapPalettes.cs
- SingleConverter.cs
- FormatControl.cs
- FormViewModeEventArgs.cs
- XmlComment.cs
- UIHelper.cs
- StandardToolWindows.cs
- SchemaUtility.cs
- MenuItemStyle.cs
- SuppressMessageAttribute.cs
- SettingsSavedEventArgs.cs
- ReflectionUtil.cs
- ValidationPropertyAttribute.cs
- Canvas.cs
- HeaderCollection.cs
- HtmlSelect.cs
- TcpPortSharing.cs
- GetWinFXPath.cs
- SafeReversePInvokeHandle.cs
- Registry.cs
- ColumnMapVisitor.cs
- ServiceDocumentFormatter.cs
- EmptyCollection.cs
- XpsResource.cs
- LocalFileSettingsProvider.cs
- DataViewSettingCollection.cs
- CallInfo.cs
- StaticResourceExtension.cs
- StandardTransformFactory.cs
- ReverseInheritProperty.cs
- ObjectStorage.cs
- TextCompositionManager.cs
- ActivityCodeDomSerializer.cs
- ItemsChangedEventArgs.cs
- SafeFreeMibTable.cs
- ModelPerspective.cs
- ColorContext.cs
- Vector3DValueSerializer.cs
- ArgumentOutOfRangeException.cs
- Matrix3DStack.cs
- DefaultTextStoreTextComposition.cs
- QilTernary.cs
- RadioButton.cs
- PathFigure.cs
- MessageOperationFormatter.cs
- GridViewColumnHeaderAutomationPeer.cs
- BitmapEffect.cs
- CustomAssemblyResolver.cs
- FontSourceCollection.cs
- WebConfigurationFileMap.cs
- QueryContinueDragEvent.cs
- InvalidStoreProtectionKeyException.cs
- Common.cs
- EditorServiceContext.cs
- PageSetupDialog.cs
- GlyphRunDrawing.cs