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
- ParenExpr.cs
- StateFinalizationActivity.cs
- ParseHttpDate.cs
- RequestResizeEvent.cs
- SystemUnicastIPAddressInformation.cs
- FacetEnabledSchemaElement.cs
- DragDrop.cs
- webclient.cs
- FormatSettings.cs
- DeploymentExceptionMapper.cs
- OutOfProcStateClientManager.cs
- Application.cs
- WindowsButton.cs
- METAHEADER.cs
- RequestTimeoutManager.cs
- DeclarationUpdate.cs
- UnsafeNativeMethods.cs
- Error.cs
- EndPoint.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- XmlNodeChangedEventArgs.cs
- QuestionEventArgs.cs
- GridViewUpdatedEventArgs.cs
- ToolboxBitmapAttribute.cs
- SolidColorBrush.cs
- ValueTable.cs
- RichTextBox.cs
- LocationFactory.cs
- DataSourceHelper.cs
- LineServicesCallbacks.cs
- DCSafeHandle.cs
- VisualCollection.cs
- PropertyPushdownHelper.cs
- WebReferenceCollection.cs
- CursorInteropHelper.cs
- DragCompletedEventArgs.cs
- HMACMD5.cs
- ReadOnlyDictionary.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- BinaryWriter.cs
- CounterSample.cs
- versioninfo.cs
- OpCopier.cs
- DataGridViewImageCell.cs
- SamlConstants.cs
- UrlMapping.cs
- DockAndAnchorLayout.cs
- SamlSerializer.cs
- DragEvent.cs
- DataReaderContainer.cs
- EntityType.cs
- OuterGlowBitmapEffect.cs
- GenericsInstances.cs
- DispatchWrapper.cs
- VariableValue.cs
- FontWeights.cs
- MonitoringDescriptionAttribute.cs
- AncestorChangedEventArgs.cs
- PerformanceCounterLib.cs
- ExtendedProtectionPolicyElement.cs
- ECDiffieHellmanPublicKey.cs
- OracleMonthSpan.cs
- NumericPagerField.cs
- XmlIncludeAttribute.cs
- BrowserCapabilitiesFactory.cs
- ItemCheckedEvent.cs
- ConstraintCollection.cs
- Int64Storage.cs
- DesignerDataSchemaClass.cs
- PositiveTimeSpanValidator.cs
- XsltArgumentList.cs
- BamlMapTable.cs
- NamespaceMapping.cs
- DataTableCollection.cs
- TextUtf8RawTextWriter.cs
- CheckPair.cs
- PriorityRange.cs
- MenuItemCollection.cs
- Renderer.cs
- XmlNullResolver.cs
- ApplicationException.cs
- HttpMethodConstraint.cs
- FigureParagraph.cs
- Crypto.cs
- UrlPath.cs
- GridViewCommandEventArgs.cs
- PackWebRequest.cs
- CreateUserErrorEventArgs.cs
- Relationship.cs
- Claim.cs
- Variant.cs
- RequestCacheValidator.cs
- RijndaelManagedTransform.cs
- TextBoxLine.cs
- Rules.cs
- LoginCancelEventArgs.cs
- SchemaImporterExtension.cs
- MenuScrollingVisibilityConverter.cs
- serverconfig.cs
- RegionData.cs