Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- WorkflowDesignerMessageFilter.cs
- MemberRestriction.cs
- SafeLibraryHandle.cs
- Int32Animation.cs
- DictionarySurrogate.cs
- SafeFindHandle.cs
- Mappings.cs
- Model3DGroup.cs
- WebPartAddingEventArgs.cs
- ComponentTray.cs
- StatusBarItem.cs
- SqlHelper.cs
- hebrewshape.cs
- EncodingNLS.cs
- RemotingServices.cs
- AspNetCompatibilityRequirementsAttribute.cs
- Base64Decoder.cs
- DynamicPropertyReader.cs
- WhitespaceSignificantCollectionAttribute.cs
- xdrvalidator.cs
- Publisher.cs
- CircleHotSpot.cs
- _RequestCacheProtocol.cs
- DataGridViewCellPaintingEventArgs.cs
- DataColumnMappingCollection.cs
- XPathCompileException.cs
- DataBoundControlActionList.cs
- CriticalHandle.cs
- ToolStripSettings.cs
- RoleGroupCollection.cs
- ConfigXmlReader.cs
- RotateTransform3D.cs
- XmlUTF8TextWriter.cs
- Control.cs
- WebPartPersonalization.cs
- StrokeCollection2.cs
- TreeBuilderXamlTranslator.cs
- RawMouseInputReport.cs
- PrivateFontCollection.cs
- KeyedQueue.cs
- DataBoundControlHelper.cs
- DelayedRegex.cs
- BooleanAnimationUsingKeyFrames.cs
- ArraySet.cs
- TaskExtensions.cs
- ConsoleEntryPoint.cs
- MarkupCompilePass1.cs
- ValidationRule.cs
- ByteAnimationUsingKeyFrames.cs
- StyleSheetComponentEditor.cs
- ErrorFormatterPage.cs
- AssemblyBuilderData.cs
- EventMappingSettingsCollection.cs
- FontUnitConverter.cs
- ComplusEndpointConfigContainer.cs
- XamlHostingSectionGroup.cs
- NamespaceList.cs
- MediaElementAutomationPeer.cs
- CodeSnippetStatement.cs
- InkCanvasFeedbackAdorner.cs
- FileDialogCustomPlace.cs
- ListItem.cs
- ToolStripLabel.cs
- SkewTransform.cs
- PropertyGridEditorPart.cs
- EntitySqlQueryBuilder.cs
- ManagementException.cs
- UserControl.cs
- GPRECT.cs
- _ShellExpression.cs
- CookielessHelper.cs
- WebSysDisplayNameAttribute.cs
- AttributeParameterInfo.cs
- ScriptDescriptor.cs
- CompensationHandlingFilter.cs
- NetNamedPipeSecurityMode.cs
- AmbientLight.cs
- ScriptControlManager.cs
- SecurityKeyType.cs
- VideoDrawing.cs
- DtrList.cs
- ImageEditor.cs
- BeginEvent.cs
- WindowsStartMenu.cs
- FixedPosition.cs
- TracingConnectionListener.cs
- TreeBuilderBamlTranslator.cs
- WebBrowser.cs
- ReturnEventArgs.cs
- VariableAction.cs
- HierarchicalDataBoundControl.cs
- LeaseManager.cs
- PointValueSerializer.cs
- BaseDataListPage.cs
- FormConverter.cs
- WebColorConverter.cs
- XPathPatternBuilder.cs
- Transform3DGroup.cs
- DataGridParentRows.cs
- SqlProfileProvider.cs