Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / Util / Pair.cs / 1305376 / 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
- ColorConvertedBitmap.cs
- ProvidePropertyAttribute.cs
- WebPartConnectionsCancelVerb.cs
- StackBuilderSink.cs
- SoapSchemaMember.cs
- RSAProtectedConfigurationProvider.cs
- Inflater.cs
- MethodAccessException.cs
- PatternMatcher.cs
- BuildProviderUtils.cs
- AdRotator.cs
- BuiltInPermissionSets.cs
- SQLCharsStorage.cs
- SegmentInfo.cs
- PcmConverter.cs
- ToolBarButtonClickEvent.cs
- XmlDocumentFieldSchema.cs
- LingerOption.cs
- SQLChars.cs
- HttpCookieCollection.cs
- FileInfo.cs
- BufferedOutputStream.cs
- XmlSerializationGeneratedCode.cs
- JpegBitmapEncoder.cs
- TaiwanLunisolarCalendar.cs
- WmlPageAdapter.cs
- SecurityTokenParameters.cs
- DashStyle.cs
- CompiledIdentityConstraint.cs
- TimeSpanStorage.cs
- DataObjectAttribute.cs
- CompileXomlTask.cs
- ValueCollectionParameterReader.cs
- Baml2006Reader.cs
- WebPartsPersonalizationAuthorization.cs
- ExtendedProperty.cs
- AttachInfo.cs
- SqlDataSourceSelectingEventArgs.cs
- TraceSection.cs
- CdpEqualityComparer.cs
- TrustDriver.cs
- Hash.cs
- ErrorHandler.cs
- SecurityManager.cs
- DesignerAttribute.cs
- DbProviderServices.cs
- ListChunk.cs
- SamlAuthorityBinding.cs
- TabItem.cs
- SelectedGridItemChangedEvent.cs
- ExternalFile.cs
- XmlSchemaExporter.cs
- AuthenticationService.cs
- ServerValidateEventArgs.cs
- DbParameterCollection.cs
- DynamicField.cs
- UseLicense.cs
- ManagedWndProcTracker.cs
- HwndProxyElementProvider.cs
- Header.cs
- StateValidator.cs
- FileStream.cs
- CustomError.cs
- CodeDelegateCreateExpression.cs
- LinkLabelLinkClickedEvent.cs
- ContainerFilterService.cs
- DataGridViewHeaderCell.cs
- ClientFormsIdentity.cs
- WpfWebRequestHelper.cs
- SchemaImporterExtension.cs
- ContractsBCL.cs
- CodeTypeParameter.cs
- ConnectionAcceptor.cs
- DataKeyArray.cs
- GZipDecoder.cs
- ArglessEventHandlerProxy.cs
- XmlBinaryReader.cs
- OleDbStruct.cs
- DbProviderSpecificTypePropertyAttribute.cs
- IChannel.cs
- DebugManager.cs
- validationstate.cs
- ApplicationFileCodeDomTreeGenerator.cs
- ManagementObjectCollection.cs
- HtmlWindow.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- DiscreteKeyFrames.cs
- GridViewColumnHeader.cs
- printdlgexmarshaler.cs
- ListBoxDesigner.cs
- UserNameSecurityTokenAuthenticator.cs
- ArgumentValueSerializer.cs
- Pair.cs
- EntityDataSourceEntitySetNameItem.cs
- CompilationSection.cs
- HttpWebRequest.cs
- NavigatorInput.cs
- PtsCache.cs
- TraceData.cs
- ConfigXmlAttribute.cs