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
- DashStyle.cs
- TableRow.cs
- StorageInfo.cs
- SerializationAttributes.cs
- VirtualizedItemProviderWrapper.cs
- XmlC14NWriter.cs
- MetadataReference.cs
- Documentation.cs
- JumpPath.cs
- NamedPipeActivation.cs
- DataBoundControlHelper.cs
- ToolboxItemCollection.cs
- DbModificationCommandTree.cs
- HtmlWindowCollection.cs
- StrongTypingException.cs
- SettingsPropertyValueCollection.cs
- BooleanKeyFrameCollection.cs
- EmptyControlCollection.cs
- HtmlEmptyTagControlBuilder.cs
- EntityType.cs
- BufferedStream.cs
- _IPv4Address.cs
- ScriptingScriptResourceHandlerSection.cs
- ResXBuildProvider.cs
- ConfigurationSectionCollection.cs
- LocalizationCodeDomSerializer.cs
- ReliableMessagingVersionConverter.cs
- SqlConnection.cs
- SystemWebExtensionsSectionGroup.cs
- FunctionImportMapping.cs
- ReflectionHelper.cs
- CrossAppDomainChannel.cs
- NetStream.cs
- ProvidePropertyAttribute.cs
- PrimitiveXmlSerializers.cs
- AxisAngleRotation3D.cs
- precedingsibling.cs
- QuestionEventArgs.cs
- FileCodeGroup.cs
- ModifierKeysValueSerializer.cs
- ComboBoxRenderer.cs
- Vector3DCollectionConverter.cs
- EntityProviderServices.cs
- SessionStateContainer.cs
- IndexOutOfRangeException.cs
- DataRowComparer.cs
- MouseGesture.cs
- NotSupportedException.cs
- HasCopySemanticsAttribute.cs
- RuntimeHandles.cs
- SoapConverter.cs
- ObjectDataSourceSelectingEventArgs.cs
- XPathAxisIterator.cs
- CounterCreationData.cs
- ObjectNotFoundException.cs
- HMACSHA384.cs
- Choices.cs
- TimestampInformation.cs
- ISAPIWorkerRequest.cs
- WebServiceParameterData.cs
- MessageContractAttribute.cs
- ToolStripPanelRenderEventArgs.cs
- PropertyChangedEventArgs.cs
- XsltLibrary.cs
- AccessDataSourceView.cs
- XmlSchemaSimpleContent.cs
- SettingsContext.cs
- MarkupExtensionSerializer.cs
- DefaultBindingPropertyAttribute.cs
- EditorZoneAutoFormat.cs
- Hash.cs
- VerificationAttribute.cs
- ConsoleKeyInfo.cs
- SplineKeyFrames.cs
- CharacterBuffer.cs
- LinkLabelLinkClickedEvent.cs
- NativeObjectSecurity.cs
- WindowsAuthenticationModule.cs
- ArrayList.cs
- ThreadStartException.cs
- MouseEvent.cs
- DataSourceNameHandler.cs
- OutputCacheSettingsSection.cs
- NativeWrapper.cs
- IdnMapping.cs
- DependencyObjectProvider.cs
- PagerSettings.cs
- ListControl.cs
- TypeUnloadedException.cs
- Line.cs
- SchemaCollectionCompiler.cs
- FontCacheUtil.cs
- MimePart.cs
- SystemResources.cs
- XpsPackagingPolicy.cs
- EntityDataSourceStatementEditorForm.cs
- FtpCachePolicyElement.cs
- SmiEventStream.cs
- Vector.cs
- Reference.cs