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
- XamlSerializer.cs
- BrowserCapabilitiesFactory.cs
- ActiveDesignSurfaceEvent.cs
- WebEventCodes.cs
- HMACSHA512.cs
- SafeArrayRankMismatchException.cs
- AxHostDesigner.cs
- TextSpan.cs
- ToolStripButton.cs
- QueryCursorEventArgs.cs
- Encoder.cs
- PageThemeParser.cs
- DeferredRunTextReference.cs
- RandomNumberGenerator.cs
- WebReferenceOptions.cs
- InputLangChangeEvent.cs
- DiagnosticTraceSource.cs
- parserscommon.cs
- WmlValidatorAdapter.cs
- KeyConstraint.cs
- ProcessInputEventArgs.cs
- GeometryModel3D.cs
- HttpsTransportElement.cs
- XmlCharCheckingReader.cs
- SqlOuterApplyReducer.cs
- VisualCollection.cs
- UriWriter.cs
- LinqDataSourceDisposeEventArgs.cs
- LinkedList.cs
- MethodImplAttribute.cs
- BindingListCollectionView.cs
- UrlPropertyAttribute.cs
- DoubleMinMaxAggregationOperator.cs
- Evaluator.cs
- TimeSpan.cs
- PropertyEmitterBase.cs
- MetabaseSettings.cs
- SelectionHighlightInfo.cs
- ToolStripContainerDesigner.cs
- DataListItem.cs
- ActivityBuilderHelper.cs
- ComponentEvent.cs
- Send.cs
- DataShape.cs
- DataGridViewComboBoxEditingControl.cs
- cookieexception.cs
- GeneratedView.cs
- DbModificationClause.cs
- ExpressionBuilderCollection.cs
- WindowsTokenRoleProvider.cs
- Token.cs
- ImpersonateTokenRef.cs
- PaintValueEventArgs.cs
- ControlPropertyNameConverter.cs
- ResumeStoryboard.cs
- EntityDataSourceContainerNameConverter.cs
- ResXDataNode.cs
- Function.cs
- ImportCatalogPart.cs
- ActiveDocumentEvent.cs
- HttpSysSettings.cs
- CodeIndexerExpression.cs
- GeneratedContractType.cs
- EntitySetBase.cs
- WindowsSecurityTokenAuthenticator.cs
- ConfigurationPermission.cs
- MetafileHeaderWmf.cs
- TextEditorParagraphs.cs
- DeferredTextReference.cs
- ChangeToolStripParentVerb.cs
- XamlReaderHelper.cs
- TransactionScope.cs
- GcSettings.cs
- InheritanceAttribute.cs
- DesignerDataSourceView.cs
- ConfigXmlReader.cs
- CodeFieldReferenceExpression.cs
- ViewSimplifier.cs
- TextContainerChangedEventArgs.cs
- ListViewSortEventArgs.cs
- OledbConnectionStringbuilder.cs
- DrawToolTipEventArgs.cs
- Codec.cs
- Crc32Helper.cs
- ProcessActivityTreeOptions.cs
- SpellerHighlightLayer.cs
- PlainXmlWriter.cs
- ProtocolsConfiguration.cs
- SqlTriggerAttribute.cs
- SqlBinder.cs
- TraceData.cs
- NamespaceList.cs
- PackWebRequest.cs
- MsmqElementBase.cs
- ScopedKnownTypes.cs
- ListSourceHelper.cs
- XmlSchemas.cs
- UrlAuthorizationModule.cs
- PathFigureCollectionConverter.cs
- ASCIIEncoding.cs