Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Linq / Parallel / Utils / WrapperEqualityComparer.cs / 1305376 / WrapperEqualityComparer.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// WrapperEqualityComparer.cs
//
// [....]
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System.Collections.Generic;
using System.Diagnostics.Contracts;
namespace System.Linq.Parallel
{
///
/// Compares two wrapped structs of the same underlying type for equality. Simply
/// wraps the actual comparer for the type being wrapped.
///
///
internal struct WrapperEqualityComparer : IEqualityComparer>
{
private IEqualityComparer m_comparer;
internal WrapperEqualityComparer(IEqualityComparer comparer)
{
if (comparer == null)
{
m_comparer = EqualityComparer.Default;
}
else
{
m_comparer = comparer;
}
}
public bool Equals(Wrapper x, Wrapper y)
{
Contract.Assert(m_comparer != null);
return m_comparer.Equals(x.Value, y.Value);
}
public int GetHashCode(Wrapper x)
{
Contract.Assert(m_comparer != null);
return m_comparer.GetHashCode(x.Value);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// WrapperEqualityComparer.cs
//
// [....]
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System.Collections.Generic;
using System.Diagnostics.Contracts;
namespace System.Linq.Parallel
{
///
/// Compares two wrapped structs of the same underlying type for equality. Simply
/// wraps the actual comparer for the type being wrapped.
///
///
internal struct WrapperEqualityComparer : IEqualityComparer>
{
private IEqualityComparer m_comparer;
internal WrapperEqualityComparer(IEqualityComparer comparer)
{
if (comparer == null)
{
m_comparer = EqualityComparer.Default;
}
else
{
m_comparer = comparer;
}
}
public bool Equals(Wrapper x, Wrapper y)
{
Contract.Assert(m_comparer != null);
return m_comparer.Equals(x.Value, y.Value);
}
public int GetHashCode(Wrapper x)
{
Contract.Assert(m_comparer != null);
return m_comparer.GetHashCode(x.Value);
}
}
}
// 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
- WebControlsSection.cs
- TypeUtil.cs
- CodeGeneratorAttribute.cs
- Atom10FeedFormatter.cs
- _AcceptOverlappedAsyncResult.cs
- StickyNoteAnnotations.cs
- ErrorWrapper.cs
- Matrix.cs
- SerializerDescriptor.cs
- TypeForwardedToAttribute.cs
- RegexStringValidatorAttribute.cs
- GPStream.cs
- WebPartEditorCancelVerb.cs
- Parsers.cs
- ImageDesigner.cs
- TypeNameConverter.cs
- XPathSelfQuery.cs
- Metadata.cs
- TextTreeDeleteContentUndoUnit.cs
- Expressions.cs
- PageAsyncTask.cs
- InvalidPrinterException.cs
- ApplicationServiceHelper.cs
- GlyphManager.cs
- ContourSegment.cs
- ImageAutomationPeer.cs
- WebPartConnection.cs
- ServiceOperation.cs
- DirectoryObjectSecurity.cs
- TypeViewSchema.cs
- SafeRegistryHandle.cs
- BrowserCapabilitiesFactory.cs
- TextEditorMouse.cs
- ValidationError.cs
- ZoomPercentageConverter.cs
- PrtCap_Builder.cs
- EmptyQuery.cs
- ObjectDataSourceView.cs
- FilteredSchemaElementLookUpTable.cs
- MaterialGroup.cs
- BinaryParser.cs
- PersianCalendar.cs
- ExpressionBuilder.cs
- RootBrowserWindowProxy.cs
- BulletChrome.cs
- MetadataArtifactLoaderComposite.cs
- TextElementEnumerator.cs
- PiiTraceSource.cs
- ReferentialConstraint.cs
- LoadedOrUnloadedOperation.cs
- SchemaInfo.cs
- DataRecordInternal.cs
- IntegerValidator.cs
- PortCache.cs
- BroadcastEventHelper.cs
- securitycriticaldataClass.cs
- TraceSection.cs
- FileLevelControlBuilderAttribute.cs
- CreateUserErrorEventArgs.cs
- SoapCodeExporter.cs
- ArrayTypeMismatchException.cs
- GrammarBuilderBase.cs
- InstallerTypeAttribute.cs
- System.Data_BID.cs
- PropertyDescriptor.cs
- TableLayoutCellPaintEventArgs.cs
- MessageHeaderDescription.cs
- ClientFormsIdentity.cs
- MenuDesigner.cs
- NetworkCredential.cs
- PropertyInfoSet.cs
- Tokenizer.cs
- WebPartEditorCancelVerb.cs
- DelegatingMessage.cs
- DependencyPropertyKind.cs
- EntityWrapper.cs
- VerticalAlignConverter.cs
- ColorContextHelper.cs
- EnlistmentTraceIdentifier.cs
- WizardForm.cs
- DirectoryNotFoundException.cs
- uribuilder.cs
- Annotation.cs
- InfoCardRSACryptoProvider.cs
- InputProcessorProfiles.cs
- FontStretch.cs
- DateTimeSerializationSection.cs
- CacheEntry.cs
- JsonGlobals.cs
- ping.cs
- GridPattern.cs
- PageAsyncTaskManager.cs
- XmlDocumentSchema.cs
- PriorityRange.cs
- DataTableExtensions.cs
- MetaModel.cs
- PlainXmlSerializer.cs
- Triangle.cs
- SystemIPInterfaceProperties.cs
- KeyFrames.cs