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
- SqlParameter.cs
- HostSecurityManager.cs
- CurrentTimeZone.cs
- WebZone.cs
- XPathSelfQuery.cs
- GlyphCache.cs
- ShaderEffect.cs
- SQLGuid.cs
- QilExpression.cs
- GroupStyle.cs
- RIPEMD160Managed.cs
- ThemeInfoAttribute.cs
- TypeSemantics.cs
- CompiledQueryCacheKey.cs
- ActivityScheduledQuery.cs
- AtomMaterializer.cs
- WebGetAttribute.cs
- WebServiceErrorEvent.cs
- ImageSource.cs
- MSAAEventDispatcher.cs
- SQLDecimalStorage.cs
- XmlTextReaderImpl.cs
- AbandonedMutexException.cs
- ShadowGlyph.cs
- EntryIndex.cs
- InputProcessorProfiles.cs
- TextElementAutomationPeer.cs
- CultureInfo.cs
- Rect3DConverter.cs
- AdapterUtil.cs
- MenuCommand.cs
- BreakRecordTable.cs
- WindowsFormsDesignerOptionService.cs
- InternalControlCollection.cs
- SlipBehavior.cs
- SqlDataSourceSelectingEventArgs.cs
- SectionInformation.cs
- PathNode.cs
- DBDataPermission.cs
- BoundColumn.cs
- SqlDependencyListener.cs
- MetadataItemCollectionFactory.cs
- TempFiles.cs
- ProjectionPath.cs
- RestHandlerFactory.cs
- TextDecorationUnitValidation.cs
- IndexOutOfRangeException.cs
- TcpClientSocketManager.cs
- Solver.cs
- FontFamilyConverter.cs
- LogPolicy.cs
- EventHandlersStore.cs
- ComboBox.cs
- TaskScheduler.cs
- FormViewRow.cs
- OdbcStatementHandle.cs
- ReferencedCollectionType.cs
- ProviderException.cs
- WebContext.cs
- Stylesheet.cs
- ModelUIElement3D.cs
- ToolZoneDesigner.cs
- TransactionContextValidator.cs
- StateMachine.cs
- XComponentModel.cs
- UndirectedGraph.cs
- ScriptManagerProxy.cs
- ToolBarPanel.cs
- CallbackHandler.cs
- DataGridDetailsPresenter.cs
- ContextTokenTypeConverter.cs
- DetailsViewModeEventArgs.cs
- AppDomainAttributes.cs
- PrintPageEvent.cs
- MailAddress.cs
- WebPartDisplayMode.cs
- XmlDataCollection.cs
- webproxy.cs
- ToolStripSettings.cs
- XMLSyntaxException.cs
- UpdateCommandGenerator.cs
- DTCTransactionManager.cs
- FilterQueryOptionExpression.cs
- PersonalizablePropertyEntry.cs
- MeshGeometry3D.cs
- Char.cs
- OneOfScalarConst.cs
- LinkClickEvent.cs
- Size.cs
- UnauthorizedAccessException.cs
- TemplateFactory.cs
- DocumentViewerBase.cs
- XsltInput.cs
- PrinterResolution.cs
- ProcessThreadCollection.cs
- PersonalizableTypeEntry.cs
- DataFormats.cs
- TrackingSection.cs
- AbandonedMutexException.cs
- OutputCacheSection.cs