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
- NamespaceEmitter.cs
- RawTextInputReport.cs
- MobileCapabilities.cs
- ScaleTransform.cs
- DateTimeUtil.cs
- BindUriHelper.cs
- Currency.cs
- XmlSchemaAnnotation.cs
- WebEvents.cs
- ResXResourceReader.cs
- OleDbConnectionInternal.cs
- TableParagraph.cs
- UpdateCommandGenerator.cs
- DeobfuscatingStream.cs
- HtmlTextViewAdapter.cs
- FormViewUpdatedEventArgs.cs
- DataViewSettingCollection.cs
- GeometryCombineModeValidation.cs
- EmbeddedObject.cs
- PolyBezierSegment.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- HtmlToClrEventProxy.cs
- DataPagerCommandEventArgs.cs
- FormatException.cs
- PageContentCollection.cs
- NameValueSectionHandler.cs
- CalendarDay.cs
- SocketInformation.cs
- DbgCompiler.cs
- SqlConnectionPoolProviderInfo.cs
- EmbossBitmapEffect.cs
- BevelBitmapEffect.cs
- ContainerActivationHelper.cs
- DirectoryInfo.cs
- EdmSchemaError.cs
- WebExceptionStatus.cs
- AdapterDictionary.cs
- PingReply.cs
- CellIdBoolean.cs
- SpecialNameAttribute.cs
- ProviderSettingsCollection.cs
- AtomMaterializerLog.cs
- Form.cs
- Animatable.cs
- WebBrowsableAttribute.cs
- BevelBitmapEffect.cs
- MouseGestureValueSerializer.cs
- ReadOnlyActivityGlyph.cs
- StringValueConverter.cs
- EastAsianLunisolarCalendar.cs
- HandlerMappingMemo.cs
- ServiceRouteHandler.cs
- QilTargetType.cs
- ResourceProviderFactory.cs
- RootAction.cs
- WebResourceUtil.cs
- UnsafeNativeMethods.cs
- ScrollBar.cs
- DispatcherEventArgs.cs
- PersonalizationEntry.cs
- PrimitiveXmlSerializers.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- ErrorTableItemStyle.cs
- FatalException.cs
- ResourceDescriptionAttribute.cs
- DiscoveryExceptionDictionary.cs
- CreatingCookieEventArgs.cs
- VectorCollectionConverter.cs
- CngProvider.cs
- MenuAdapter.cs
- ShutDownListener.cs
- TextModifierScope.cs
- ReferencedAssemblyResolver.cs
- XmlSchemaParticle.cs
- EDesignUtil.cs
- EventMappingSettings.cs
- OutputCache.cs
- HttpDebugHandler.cs
- InputLanguageSource.cs
- ObjectDataSourceEventArgs.cs
- DataGridViewTopLeftHeaderCell.cs
- EntityDataSourceViewSchema.cs
- EventLogTraceListener.cs
- RequestCacheManager.cs
- EntitySqlException.cs
- RemoveStoryboard.cs
- TextTreePropertyUndoUnit.cs
- TrackingStringDictionary.cs
- SrgsElementFactory.cs
- CryptoApi.cs
- RoutedCommand.cs
- DefaultProfileManager.cs
- GeneratedCodeAttribute.cs
- TextStore.cs
- PrintDocument.cs
- XhtmlBasicCommandAdapter.cs
- HitTestParameters.cs
- CodeTypeReferenceExpression.cs
- EUCJPEncoding.cs
- X509ThumbprintKeyIdentifierClause.cs