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
- IconBitmapDecoder.cs
- HealthMonitoringSectionHelper.cs
- ToolStripContainerDesigner.cs
- DesignerTextBoxAdapter.cs
- TypeDescriptor.cs
- ThreadStartException.cs
- PeerMessageDispatcher.cs
- CodeDirectionExpression.cs
- SamlAction.cs
- IOThreadTimer.cs
- FieldReference.cs
- RequestBringIntoViewEventArgs.cs
- SynchronizationLockException.cs
- MarginsConverter.cs
- HandledEventArgs.cs
- Control.cs
- AuthenticationServiceManager.cs
- Literal.cs
- Point3D.cs
- xmlfixedPageInfo.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- String.cs
- TokenBasedSet.cs
- LongValidator.cs
- Substitution.cs
- Module.cs
- AssemblyName.cs
- MessageQueueTransaction.cs
- MulticastOption.cs
- TextRange.cs
- MessageSmuggler.cs
- FrameworkElementFactory.cs
- StackBuilderSink.cs
- WebPartEditorApplyVerb.cs
- MessageQueueException.cs
- FrameworkTextComposition.cs
- HuffCodec.cs
- KeyTimeConverter.cs
- RoleGroup.cs
- SettingsPropertyCollection.cs
- SafeArrayTypeMismatchException.cs
- WriteableBitmap.cs
- XmlReaderSettings.cs
- AsynchronousChannelMergeEnumerator.cs
- DictionaryMarkupSerializer.cs
- SHA1CryptoServiceProvider.cs
- KeyboardEventArgs.cs
- CompositeScriptReferenceEventArgs.cs
- BindingWorker.cs
- ClrPerspective.cs
- FillRuleValidation.cs
- ClientSideQueueItem.cs
- SessionPageStatePersister.cs
- TextRunCacheImp.cs
- Double.cs
- Win32Native.cs
- SecurityKeyIdentifierClause.cs
- DataObjectSettingDataEventArgs.cs
- RSAPKCS1SignatureFormatter.cs
- LinqDataSourceUpdateEventArgs.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- GlyphShapingProperties.cs
- Base64Decoder.cs
- RayHitTestParameters.cs
- AtomParser.cs
- MimeTypePropertyAttribute.cs
- WebEventTraceProvider.cs
- SuppressIldasmAttribute.cs
- EmptyCollection.cs
- Control.cs
- MouseButtonEventArgs.cs
- VirtualDirectoryMapping.cs
- EntityViewGenerationAttribute.cs
- GPStream.cs
- SmtpReplyReader.cs
- ShaperBuffers.cs
- RegionIterator.cs
- SafeCoTaskMem.cs
- StylusPointPropertyInfo.cs
- RegexStringValidatorAttribute.cs
- StyleSheetDesigner.cs
- ResXResourceWriter.cs
- controlskin.cs
- SchemaTableColumn.cs
- LabelLiteral.cs
- ExpressionBuilder.cs
- GridItemCollection.cs
- _BaseOverlappedAsyncResult.cs
- HtmlFormWrapper.cs
- RelatedEnd.cs
- CodeTypeReferenceCollection.cs
- Mapping.cs
- _AcceptOverlappedAsyncResult.cs
- StylusLogic.cs
- Bitmap.cs
- SqlCacheDependencyDatabaseCollection.cs
- TraceHandler.cs
- Expander.cs
- CacheOutputQuery.cs
- CodeParameterDeclarationExpression.cs