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
- BitStack.cs
- XmlTypeAttribute.cs
- ApplicationManager.cs
- DockPattern.cs
- ValueSerializer.cs
- DataGridViewTopLeftHeaderCell.cs
- SqlCommandBuilder.cs
- ScriptIgnoreAttribute.cs
- BaseCollection.cs
- PageBuildProvider.cs
- StringUtil.cs
- DrawingImage.cs
- DeviceContext.cs
- RepeaterItemEventArgs.cs
- ImageField.cs
- PrimitiveCodeDomSerializer.cs
- UnsafeNativeMethods.cs
- EntryPointNotFoundException.cs
- LocationReferenceEnvironment.cs
- InfoCardBaseException.cs
- AppDomainManager.cs
- IdentifierCollection.cs
- Window.cs
- CodeObjectCreateExpression.cs
- InputLangChangeRequestEvent.cs
- LaxModeSecurityHeaderElementInferenceEngine.cs
- UnitySerializationHolder.cs
- FormParameter.cs
- RangeContentEnumerator.cs
- StreamInfo.cs
- securitycriticaldataformultiplegetandset.cs
- DiscoveryRequestHandler.cs
- TextEditorSpelling.cs
- AssemblyInfo.cs
- PasswordDeriveBytes.cs
- FlowLayoutPanel.cs
- HttpWebRequest.cs
- BitmapFrame.cs
- ProviderBase.cs
- DataGridViewCellCancelEventArgs.cs
- XmlQualifiedNameTest.cs
- CodeExpressionCollection.cs
- RemotingConfigParser.cs
- CodeSpit.cs
- ColumnMapVisitor.cs
- UpdatePanel.cs
- UrlEncodedParameterWriter.cs
- ParagraphVisual.cs
- ListBox.cs
- PointCollectionValueSerializer.cs
- InitializationEventAttribute.cs
- SchemaMapping.cs
- UIElement3D.cs
- SynchronousChannel.cs
- Compiler.cs
- ReflectionServiceProvider.cs
- DescriptionAttribute.cs
- Thumb.cs
- MarginsConverter.cs
- DetailsViewRowCollection.cs
- WebReferenceCollection.cs
- OleDbConnectionFactory.cs
- ObjectStateFormatter.cs
- DrawToolTipEventArgs.cs
- AnnotationComponentManager.cs
- MultiAsyncResult.cs
- MatcherBuilder.cs
- XPathDocumentIterator.cs
- NativeWindow.cs
- Random.cs
- SafeRightsManagementHandle.cs
- QueueSurrogate.cs
- XomlDesignerLoader.cs
- AnnotationResourceChangedEventArgs.cs
- NeutralResourcesLanguageAttribute.cs
- ObjectAnimationBase.cs
- DefaultWorkflowLoaderService.cs
- keycontainerpermission.cs
- BaseParser.cs
- MobileCategoryAttribute.cs
- ToolStrip.cs
- Condition.cs
- BitmapEffectInputConnector.cs
- QilBinary.cs
- SqlUtil.cs
- RegexBoyerMoore.cs
- ObjectStateFormatter.cs
- PropertyInfo.cs
- BaseValidatorDesigner.cs
- GridViewUpdateEventArgs.cs
- MD5HashHelper.cs
- LinkDescriptor.cs
- StateChangeEvent.cs
- login.cs
- XmlSchemaSimpleTypeUnion.cs
- CustomPeerResolverService.cs
- StickyNote.cs
- _RequestCacheProtocol.cs
- WebBrowserBase.cs
- GregorianCalendarHelper.cs