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
- DataGridViewIntLinkedList.cs
- ApplicationSecurityInfo.cs
- FixedSOMContainer.cs
- EntryIndex.cs
- ScriptManagerProxy.cs
- ListControlDataBindingHandler.cs
- NumericUpDown.cs
- DrawingAttributeSerializer.cs
- WorkflowInstanceTerminatedRecord.cs
- ListViewPagedDataSource.cs
- Double.cs
- DynamicRendererThreadManager.cs
- TextOutput.cs
- SecurityKeyIdentifier.cs
- ClientCultureInfo.cs
- OdbcInfoMessageEvent.cs
- MatrixTransform.cs
- OLEDB_Enum.cs
- AttributeCollection.cs
- CodeAttributeDeclarationCollection.cs
- SrgsNameValueTag.cs
- PropertyEmitterBase.cs
- StringArrayConverter.cs
- TextBox.cs
- PrivilegeNotHeldException.cs
- UrlMapping.cs
- PrimitiveSchema.cs
- GenericAuthenticationEventArgs.cs
- SerializationInfo.cs
- EntityDataSourceDesignerHelper.cs
- AttributedMetaModel.cs
- SerializationSectionGroup.cs
- PolyQuadraticBezierSegment.cs
- IndividualDeviceConfig.cs
- SynchronizedInputAdaptor.cs
- Menu.cs
- DBCSCodePageEncoding.cs
- UMPAttributes.cs
- PageSettings.cs
- CompressedStack.cs
- BamlRecordHelper.cs
- EntityContainerRelationshipSetEnd.cs
- HasCopySemanticsAttribute.cs
- FillBehavior.cs
- LockCookie.cs
- TextLineResult.cs
- SecurityVersion.cs
- TimelineClockCollection.cs
- CqlParser.cs
- TextTreeRootNode.cs
- FormViewInsertedEventArgs.cs
- SystemUdpStatistics.cs
- GridItem.cs
- TrackingProfileCache.cs
- ConnectionsZoneDesigner.cs
- WindowsAuthenticationModule.cs
- OuterGlowBitmapEffect.cs
- ModelChangedEventArgsImpl.cs
- DefaultValueAttribute.cs
- Path.cs
- SqlDesignerDataSourceView.cs
- Triangle.cs
- assemblycache.cs
- AuthenticationServiceManager.cs
- TextRunProperties.cs
- BamlRecords.cs
- _DynamicWinsockMethods.cs
- SrgsRule.cs
- TemplateColumn.cs
- DateTimeConverter2.cs
- HelpExampleGenerator.cs
- MemberPath.cs
- NonVisualControlAttribute.cs
- IncrementalCompileAnalyzer.cs
- SafeEventHandle.cs
- MinMaxParagraphWidth.cs
- StreamGeometry.cs
- TreeNodeCollection.cs
- DataServiceRequestOfT.cs
- ViewGenResults.cs
- GZipStream.cs
- ResourcePool.cs
- FlowDocumentReaderAutomationPeer.cs
- SharedHttpTransportManager.cs
- SpellerInterop.cs
- VectorAnimationBase.cs
- EnumCodeDomSerializer.cs
- DataGridTextBox.cs
- RegisteredScript.cs
- HtmlInputImage.cs
- OAVariantLib.cs
- SecurityContextCookieSerializer.cs
- FrameworkReadOnlyPropertyMetadata.cs
- TextTreeInsertElementUndoUnit.cs
- DependencyObjectPropertyDescriptor.cs
- FrameworkContentElementAutomationPeer.cs
- XmlSchemaType.cs
- BinaryMethodMessage.cs
- TemplatePropertyEntry.cs
- ListView.cs