Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / xsp / System / Web / Extensions / Util / Pair.cs / 1 / 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
- UnsafeNativeMethods.cs
- SystemSounds.cs
- SchemaNames.cs
- RewritingValidator.cs
- SettingsPropertyWrongTypeException.cs
- XPathNode.cs
- ForceCopyBuildProvider.cs
- FormatException.cs
- StatusBar.cs
- ContractMapping.cs
- ClientTarget.cs
- KeyValuePairs.cs
- Component.cs
- UIntPtr.cs
- ImageDrawing.cs
- TargetInvocationException.cs
- AsymmetricSignatureFormatter.cs
- IntegerCollectionEditor.cs
- RemoteHelper.cs
- BamlTreeMap.cs
- HostingPreferredMapPath.cs
- RequestTimeoutManager.cs
- TextTrailingWordEllipsis.cs
- SQLDoubleStorage.cs
- SkipStoryboardToFill.cs
- SocketException.cs
- VisualBrush.cs
- HttpModuleCollection.cs
- SQLDateTime.cs
- ResourceProviderFactory.cs
- OracleCommand.cs
- PreDigestedSignedInfo.cs
- remotingproxy.cs
- XmlSchemaAnyAttribute.cs
- SqlClientWrapperSmiStreamChars.cs
- XmlSchemaSimpleTypeRestriction.cs
- HtmlCalendarAdapter.cs
- SeekableMessageNavigator.cs
- LabelLiteral.cs
- MetadataUtil.cs
- DiagnosticTraceSource.cs
- WindowsFormsHelpers.cs
- ReadOnlyDataSource.cs
- XmlCodeExporter.cs
- SqlNotificationRequest.cs
- RootNamespaceAttribute.cs
- Axis.cs
- TemplateKeyConverter.cs
- ErrorHandler.cs
- HotSpotCollection.cs
- CompressEmulationStream.cs
- OleDbParameter.cs
- FormsAuthenticationEventArgs.cs
- Baml2006KeyRecord.cs
- XmlLanguageConverter.cs
- FormParameter.cs
- Translator.cs
- XmlSchemaComplexContent.cs
- elementinformation.cs
- TextBlock.cs
- StylusPointPropertyUnit.cs
- GeneralTransformCollection.cs
- VisualStyleTypesAndProperties.cs
- HTTPNotFoundHandler.cs
- XmlAttributeCache.cs
- FontSizeConverter.cs
- DBCSCodePageEncoding.cs
- SystemIPv4InterfaceProperties.cs
- GeometryGroup.cs
- ValidatorCompatibilityHelper.cs
- ChangeTracker.cs
- XpsFilter.cs
- GridViewHeaderRowPresenter.cs
- DbConnectionInternal.cs
- ClientTargetSection.cs
- SvcMapFileSerializer.cs
- XdrBuilder.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- ControlType.cs
- ListenerConnectionDemuxer.cs
- BinaryFormatter.cs
- XmlDataSourceNodeDescriptor.cs
- AnchoredBlock.cs
- StateElement.cs
- RefType.cs
- KerberosSecurityTokenProvider.cs
- SoapEnumAttribute.cs
- ControlAdapter.cs
- WebColorConverter.cs
- SplitterPanelDesigner.cs
- SmtpTransport.cs
- CacheHelper.cs
- CompilerScopeManager.cs
- figurelength.cs
- XmlQueryRuntime.cs
- XmlComment.cs
- OdbcCommandBuilder.cs
- NativeObjectSecurity.cs
- TypeNameConverter.cs
- Timer.cs