Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / Common / Utils / Pair.cs / 1 / Pair.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.Linq; namespace System.Data.Common.Utils { internal class Pair: InternalBase { #region Fields private readonly TFirst first; private readonly TSecond second; #endregion #region Constructor internal Pair(TFirst first, TSecond second) { this.first = first; this.second = second; } #endregion #region Properties internal TFirst First { get { return first; } } internal TSecond Second { get { return second; } } #endregion #region Methods public override int GetHashCode() { return (first.GetHashCode()<<5) ^ second.GetHashCode(); } public bool Equals(Pair other) { return first.Equals(other.first) && second.Equals(other.second); } public override bool Equals(object other) { Pair otherPair = other as Pair ; return (otherPair != null && Equals(otherPair)); } #endregion #region InternalBase internal override void ToCompactString(StringBuilder builder) { builder.Append("<"); builder.Append(first.ToString()); builder.Append(", "+second.ToString()); builder.Append(">"); } #endregion internal class PairComparer : IEqualityComparer > { private PairComparer() { } internal static readonly PairComparer Instance = new PairComparer(); private static readonly EqualityComparer firstComparer = EqualityComparer .Default; private static readonly EqualityComparer secondComparer = EqualityComparer .Default; public bool Equals(Pair x, Pair y) { return firstComparer.Equals(x.First, y.First) && secondComparer.Equals(x.Second, y.Second); } public int GetHashCode(Pair source) { return source.GetHashCode(); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.Linq; namespace System.Data.Common.Utils { internal class Pair: InternalBase { #region Fields private readonly TFirst first; private readonly TSecond second; #endregion #region Constructor internal Pair(TFirst first, TSecond second) { this.first = first; this.second = second; } #endregion #region Properties internal TFirst First { get { return first; } } internal TSecond Second { get { return second; } } #endregion #region Methods public override int GetHashCode() { return (first.GetHashCode()<<5) ^ second.GetHashCode(); } public bool Equals(Pair other) { return first.Equals(other.first) && second.Equals(other.second); } public override bool Equals(object other) { Pair otherPair = other as Pair ; return (otherPair != null && Equals(otherPair)); } #endregion #region InternalBase internal override void ToCompactString(StringBuilder builder) { builder.Append("<"); builder.Append(first.ToString()); builder.Append(", "+second.ToString()); builder.Append(">"); } #endregion internal class PairComparer : IEqualityComparer > { private PairComparer() { } internal static readonly PairComparer Instance = new PairComparer(); private static readonly EqualityComparer firstComparer = EqualityComparer .Default; private static readonly EqualityComparer secondComparer = EqualityComparer .Default; public bool Equals(Pair x, Pair y) { return firstComparer.Equals(x.First, y.First) && secondComparer.Equals(x.Second, y.Second); } public int GetHashCode(Pair source) { return source.GetHashCode(); } } } } // 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
- RootDesignerSerializerAttribute.cs
- DataGridViewUtilities.cs
- OleDbSchemaGuid.cs
- WebPartConnectionsCancelVerb.cs
- Quaternion.cs
- RowUpdatedEventArgs.cs
- TriState.cs
- TemplatePagerField.cs
- BitStack.cs
- FormsAuthenticationUser.cs
- ScriptingScriptResourceHandlerSection.cs
- SectionVisual.cs
- DataSourceGeneratorException.cs
- RemoteWebConfigurationHostStream.cs
- CompModSwitches.cs
- AvTraceDetails.cs
- OutputCacheProfile.cs
- BrowserCapabilitiesCompiler.cs
- mediaclock.cs
- PasswordRecovery.cs
- TextTreeObjectNode.cs
- HttpWriter.cs
- hebrewshape.cs
- SqlProcedureAttribute.cs
- TableRow.cs
- XmlComplianceUtil.cs
- DataGridViewCellCancelEventArgs.cs
- ProcessProtocolHandler.cs
- PerfProviderCollection.cs
- RawAppCommandInputReport.cs
- ExtensibleClassFactory.cs
- SystemColorTracker.cs
- SpecularMaterial.cs
- Matrix3D.cs
- xdrvalidator.cs
- AssociationSetMetadata.cs
- BinaryFormatter.cs
- _ProxyChain.cs
- relpropertyhelper.cs
- ZipIORawDataFileBlock.cs
- XmlNodeChangedEventArgs.cs
- FormParameter.cs
- TaskExtensions.cs
- DbDataSourceEnumerator.cs
- DeferredElementTreeState.cs
- bidPrivateBase.cs
- WebPartCatalogAddVerb.cs
- CompilerCollection.cs
- PropertyMetadata.cs
- NestPullup.cs
- UnsafeNativeMethods.cs
- DigitShape.cs
- InternalRelationshipCollection.cs
- InstalledFontCollection.cs
- RichTextBox.cs
- XmlSchemaSimpleContent.cs
- TreeNodeStyleCollection.cs
- CodePageUtils.cs
- TextBox.cs
- SvcFileManager.cs
- RegexParser.cs
- AccessedThroughPropertyAttribute.cs
- Command.cs
- SafePEFileHandle.cs
- XmlAttributeProperties.cs
- WpfXamlMember.cs
- TrustManagerPromptUI.cs
- BinaryObjectReader.cs
- InputScope.cs
- SafeNativeMethods.cs
- BooleanConverter.cs
- XMLSchema.cs
- EndpointConfigContainer.cs
- SelectionItemProviderWrapper.cs
- FixedFindEngine.cs
- ReachPageContentCollectionSerializerAsync.cs
- XmlDownloadManager.cs
- ObjectSecurity.cs
- FileIOPermission.cs
- MinMaxParagraphWidth.cs
- ExceptQueryOperator.cs
- LiteralTextContainerControlBuilder.cs
- InlineObject.cs
- SetterBase.cs
- UpdateTracker.cs
- InternalBufferOverflowException.cs
- BackgroundFormatInfo.cs
- ImageEditor.cs
- ExpressionContext.cs
- QuaternionRotation3D.cs
- CustomCategoryAttribute.cs
- AsymmetricKeyExchangeFormatter.cs
- DependentList.cs
- RangeValueProviderWrapper.cs
- InkSerializer.cs
- TextTreeTextElementNode.cs
- SystemTcpConnection.cs
- NameSpaceExtractor.cs
- StatusBar.cs
- OleDragDropHandler.cs