Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Common / Utils / Pair.cs / 1305376 / 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
- DataFormats.cs
- AliasedExpr.cs
- WizardForm.cs
- TextElementEnumerator.cs
- Zone.cs
- UIElementParagraph.cs
- DrawingState.cs
- DelegatingStream.cs
- StateChangeEvent.cs
- XPathNodeHelper.cs
- HttpValueCollection.cs
- ObjectNotFoundException.cs
- StateManagedCollection.cs
- ScriptServiceAttribute.cs
- Serialization.cs
- Pointer.cs
- PartitionerStatic.cs
- TableItemProviderWrapper.cs
- XmlBaseReader.cs
- SoapInteropTypes.cs
- TraceHandlerErrorFormatter.cs
- ListenUriMode.cs
- ObjectListSelectEventArgs.cs
- ProxyElement.cs
- WindowsIPAddress.cs
- InputScopeManager.cs
- ByValueEqualityComparer.cs
- WorkerRequest.cs
- HideDisabledControlAdapter.cs
- SatelliteContractVersionAttribute.cs
- WmlValidationSummaryAdapter.cs
- Vector3dCollection.cs
- XmlTextEncoder.cs
- SchemaTableOptionalColumn.cs
- XPathParser.cs
- TreeViewHitTestInfo.cs
- StyleBamlRecordReader.cs
- DLinqTableProvider.cs
- StaticResourceExtension.cs
- DataControlFieldHeaderCell.cs
- WsdlParser.cs
- Vector3DConverter.cs
- FileFormatException.cs
- HttpDebugHandler.cs
- DynamicResourceExtension.cs
- CompilerScope.Storage.cs
- CodeTypeDelegate.cs
- MessageDirection.cs
- EventData.cs
- Component.cs
- AccessViolationException.cs
- XmlObjectSerializerWriteContextComplex.cs
- RadioButtonFlatAdapter.cs
- ProtocolReflector.cs
- SafeNativeMethodsMilCoreApi.cs
- SchemaMapping.cs
- XmlNullResolver.cs
- PropertyInfoSet.cs
- DrawingAttributes.cs
- ColorMatrix.cs
- ConnectionStringSettingsCollection.cs
- CalendarModeChangedEventArgs.cs
- FrameworkContentElement.cs
- ImageCodecInfo.cs
- RadioButtonList.cs
- ProfileInfo.cs
- IIS7ConfigurationLoader.cs
- RowVisual.cs
- RectangleGeometry.cs
- DataGridViewTopLeftHeaderCell.cs
- HtmlTitle.cs
- DocumentViewerConstants.cs
- DataGridViewCellLinkedList.cs
- DataRow.cs
- MetadataCache.cs
- ContextDataSourceContextData.cs
- TextStore.cs
- Metadata.cs
- HtmlTextArea.cs
- DataGridViewAdvancedBorderStyle.cs
- EncryptedData.cs
- PrintPageEvent.cs
- XpsS0ValidatingLoader.cs
- EntityViewGenerationAttribute.cs
- COM2ExtendedUITypeEditor.cs
- ObjectFullSpanRewriter.cs
- WindowsGrip.cs
- UxThemeWrapper.cs
- EllipseGeometry.cs
- SystemColorTracker.cs
- regiisutil.cs
- HttpValueCollection.cs
- Pair.cs
- KeyboardNavigation.cs
- DebuggerAttributes.cs
- RemotingConfiguration.cs
- NamespaceInfo.cs
- Graphics.cs
- HandleScope.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs