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
- RegionInfo.cs
- ScriptResourceDefinition.cs
- _SpnDictionary.cs
- ArraySegment.cs
- AsyncCompletedEventArgs.cs
- RootAction.cs
- CryptoStream.cs
- DebugView.cs
- PublisherIdentityPermission.cs
- HttpCapabilitiesBase.cs
- Operator.cs
- ToolStripDropDownItem.cs
- MsmqHostedTransportConfiguration.cs
- DynamicRendererThreadManager.cs
- OutputScopeManager.cs
- XmlSchemaAnyAttribute.cs
- ResourcePool.cs
- SecurityTokenResolver.cs
- VirtualDirectoryMapping.cs
- CompressEmulationStream.cs
- MetabaseSettingsIis7.cs
- RuntimeConfig.cs
- WorkflowInstanceProxy.cs
- FontFamily.cs
- PagedDataSource.cs
- SqlAliaser.cs
- VideoDrawing.cs
- LeaseManager.cs
- LinqDataSourceSelectEventArgs.cs
- RegisteredArrayDeclaration.cs
- BoundingRectTracker.cs
- CompressedStack.cs
- AnimationClockResource.cs
- IPHostEntry.cs
- ConfigXmlWhitespace.cs
- DBNull.cs
- CqlIdentifiers.cs
- RedBlackList.cs
- ExpressionParser.cs
- TextBox.cs
- CodeSubDirectoriesCollection.cs
- DbException.cs
- PropVariant.cs
- XamlDesignerSerializationManager.cs
- ImportCatalogPart.cs
- MsmqBindingElementBase.cs
- ContextBase.cs
- CodeCompileUnit.cs
- LayoutInformation.cs
- FormViewPagerRow.cs
- LinkUtilities.cs
- TemplateControlParser.cs
- ImageMap.cs
- WindowInteropHelper.cs
- WebRequestModulesSection.cs
- TypeListConverter.cs
- EntryWrittenEventArgs.cs
- SerializationEventsCache.cs
- PeerApplication.cs
- ListViewGroupConverter.cs
- UserPreferenceChangedEventArgs.cs
- DataGridCell.cs
- DocumentOrderComparer.cs
- XamlRtfConverter.cs
- AxWrapperGen.cs
- ErrorStyle.cs
- DBPropSet.cs
- DataObjectPastingEventArgs.cs
- Memoizer.cs
- VideoDrawing.cs
- FreezableCollection.cs
- MenuCommand.cs
- GridViewColumnHeaderAutomationPeer.cs
- WindowsAuthenticationModule.cs
- PolyBezierSegment.cs
- EntityKey.cs
- ConfigurationLocation.cs
- ServiceEndpointAssociationProvider.cs
- Application.cs
- TextBoxRenderer.cs
- HwndHost.cs
- ObjectStateManagerMetadata.cs
- SQLInt64Storage.cs
- PersonalizationEntry.cs
- ToolStripPanelSelectionGlyph.cs
- HtmlInputFile.cs
- AttributeCollection.cs
- EnumValAlphaComparer.cs
- DBCSCodePageEncoding.cs
- ParameterCollection.cs
- ToolStripItem.cs
- FileSecurity.cs
- ChangePassword.cs
- SqlDataAdapter.cs
- DesignerHelpers.cs
- HttpClientCertificate.cs
- CustomCategoryAttribute.cs
- FreeFormDesigner.cs
- SqlInternalConnectionSmi.cs
- TiffBitmapDecoder.cs