Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- HttpGetServerProtocol.cs
- ObjectViewListener.cs
- DBConcurrencyException.cs
- TagPrefixInfo.cs
- DoubleCollectionValueSerializer.cs
- WebPartCancelEventArgs.cs
- ControlLocalizer.cs
- TextEditorSelection.cs
- DataGridViewCheckBoxCell.cs
- ProviderConnectionPointCollection.cs
- SymmetricSecurityProtocol.cs
- StrongTypingException.cs
- StringSorter.cs
- DesignerAttribute.cs
- PTManager.cs
- BitmapFrameDecode.cs
- KeyTimeConverter.cs
- COSERVERINFO.cs
- SecurityUtils.cs
- SafeHandles.cs
- TemplateApplicationHelper.cs
- CompositionAdorner.cs
- XmlBinaryWriterSession.cs
- DataGridViewCell.cs
- TemplatedWizardStep.cs
- PolyBezierSegment.cs
- StylusTip.cs
- KeyValueConfigurationElement.cs
- XsltLibrary.cs
- DrawingContext.cs
- HtmlTableRowCollection.cs
- Convert.cs
- Site.cs
- AggregateException.cs
- JpegBitmapEncoder.cs
- VarRemapper.cs
- WebDisplayNameAttribute.cs
- SecurityChannelListener.cs
- SerializableAttribute.cs
- SqlDataSourceCommandParser.cs
- DataGridCellsPresenter.cs
- AsymmetricCryptoHandle.cs
- OpCellTreeNode.cs
- PageThemeBuildProvider.cs
- DynamicRenderer.cs
- CorrelationService.cs
- HWStack.cs
- FullTextBreakpoint.cs
- ProviderManager.cs
- ContentOperations.cs
- ScrollChrome.cs
- SelectionPatternIdentifiers.cs
- MessageProtectionOrder.cs
- TimerElapsedEvenArgs.cs
- SQLInt64Storage.cs
- WindowsPrincipal.cs
- SafeViewOfFileHandle.cs
- DocumentAutomationPeer.cs
- CollectionViewSource.cs
- WebPartMenuStyle.cs
- PartialClassGenerationTaskInternal.cs
- SQLDoubleStorage.cs
- ColorTranslator.cs
- ReflectEventDescriptor.cs
- PipeSecurity.cs
- TableParagraph.cs
- EntityDataSourceSelectedEventArgs.cs
- assertwrapper.cs
- ApplicationContext.cs
- ExpressionBuilderCollection.cs
- RegistryPermission.cs
- XmlSiteMapProvider.cs
- StoreItemCollection.Loader.cs
- MetaChildrenColumn.cs
- CheckedPointers.cs
- QueryOptionExpression.cs
- PropertyGridEditorPart.cs
- PathData.cs
- PermissionSetEnumerator.cs
- CollectionChangeEventArgs.cs
- OleStrCAMarshaler.cs
- MergePropertyDescriptor.cs
- DotAtomReader.cs
- GroupByQueryOperator.cs
- DockPattern.cs
- EntityDataSourceStatementEditor.cs
- MembershipValidatePasswordEventArgs.cs
- Native.cs
- CallbackHandler.cs
- QilTypeChecker.cs
- OdbcEnvironmentHandle.cs
- Line.cs
- PersonalizableTypeEntry.cs
- MsmqInputChannelListener.cs
- BinaryMethodMessage.cs
- AssemblyFilter.cs
- PaintEvent.cs
- AuthenticationService.cs
- FormParameter.cs
- ServicePoint.cs