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
- MappingException.cs
- EntitySqlQueryState.cs
- ProjectionCamera.cs
- PageContent.cs
- TreeIterators.cs
- altserialization.cs
- SerializationInfoEnumerator.cs
- RegionInfo.cs
- AssertHelper.cs
- DesignOnlyAttribute.cs
- Serializer.cs
- RootBrowserWindow.cs
- XmlNodeComparer.cs
- DataTrigger.cs
- SqlMethodAttribute.cs
- ProxySimple.cs
- DataPagerField.cs
- CFGGrammar.cs
- storepermission.cs
- MsmqChannelListenerBase.cs
- DesignTimeTemplateParser.cs
- SynchronizationHandlesCodeDomSerializer.cs
- RegexRunner.cs
- ReceiveSecurityHeaderEntry.cs
- DTCTransactionManager.cs
- TypeDescriptor.cs
- DataGridViewBindingCompleteEventArgs.cs
- ToolTip.cs
- PropertyItem.cs
- XmlNamespaceMappingCollection.cs
- DragDeltaEventArgs.cs
- ParsedRoute.cs
- ConnectionsZoneDesigner.cs
- JoinElimination.cs
- mediaeventshelper.cs
- DbgCompiler.cs
- InternalEnumValidator.cs
- DeflateInput.cs
- NavigationWindow.cs
- NamespaceMapping.cs
- FieldBuilder.cs
- StateMachineSubscription.cs
- MetadataHelper.cs
- VisualStyleElement.cs
- DecimalFormatter.cs
- DictionaryChange.cs
- XmlTypeMapping.cs
- MergePropertyDescriptor.cs
- MetadataArtifactLoader.cs
- WebDisplayNameAttribute.cs
- SqlMetaData.cs
- CacheForPrimitiveTypes.cs
- TextWriter.cs
- SafeCancelMibChangeNotify.cs
- PropertyItem.cs
- WebPartEditVerb.cs
- XmlSignatureManifest.cs
- ResourceBinder.cs
- ArraySubsetEnumerator.cs
- SqlFunctions.cs
- ValidationPropertyAttribute.cs
- NetworkInformationPermission.cs
- ModelUIElement3D.cs
- ViewBox.cs
- HelpKeywordAttribute.cs
- EditingCommands.cs
- AppDomainAttributes.cs
- GridView.cs
- LinkedList.cs
- FunctionDescription.cs
- MaterialGroup.cs
- GroupDescription.cs
- RadioButtonFlatAdapter.cs
- CompiledELinqQueryState.cs
- Page.cs
- SegmentInfo.cs
- DrawingGroup.cs
- SourceFileBuildProvider.cs
- ClientUrlResolverWrapper.cs
- LookupNode.cs
- OrderPreservingPipeliningSpoolingTask.cs
- BaseTypeViewSchema.cs
- SettingsBase.cs
- MarkupExtensionSerializer.cs
- _TransmitFileOverlappedAsyncResult.cs
- IdentityModelDictionary.cs
- CellQuery.cs
- TextTreeNode.cs
- HtmlInputHidden.cs
- X509ServiceCertificateAuthenticationElement.cs
- HtmlInputHidden.cs
- IUnknownConstantAttribute.cs
- RuleConditionDialog.cs
- TextElementAutomationPeer.cs
- FontClient.cs
- ToolboxItemAttribute.cs
- InternalsVisibleToAttribute.cs
- CfgParser.cs
- ThreadExceptionDialog.cs
- ZipIOExtraFieldZip64Element.cs