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
- JoinGraph.cs
- PropertyOverridesDialog.cs
- ScrollProviderWrapper.cs
- PersistenceTypeAttribute.cs
- MessagePropertyAttribute.cs
- OleDbParameter.cs
- DataServiceConfiguration.cs
- ArrayListCollectionBase.cs
- SelectionItemProviderWrapper.cs
- ChangeConflicts.cs
- TypeReference.cs
- DictionaryEntry.cs
- RepeaterItemCollection.cs
- ActiveDocumentEvent.cs
- MemberCollection.cs
- ChangeNode.cs
- XmlDataSourceNodeDescriptor.cs
- DynamicAttribute.cs
- PaperSize.cs
- ItemCheckedEvent.cs
- Path.cs
- Bezier.cs
- TypeBuilderInstantiation.cs
- CodeIndexerExpression.cs
- LowerCaseStringConverter.cs
- unsafeIndexingFilterStream.cs
- Serializer.cs
- CheckoutException.cs
- FastEncoderWindow.cs
- MouseEventArgs.cs
- StreamResourceInfo.cs
- SplitContainer.cs
- SerialReceived.cs
- WebSysDisplayNameAttribute.cs
- ConfigUtil.cs
- MultiSelector.cs
- CommandManager.cs
- ChannelManagerService.cs
- MatrixTransform3D.cs
- Stroke2.cs
- TableItemPattern.cs
- Stroke.cs
- WebSysDefaultValueAttribute.cs
- SSmlParser.cs
- TransformGroup.cs
- PageRequestManager.cs
- CodeNamespaceCollection.cs
- BamlResourceDeserializer.cs
- SimpleWebHandlerParser.cs
- ResourceManager.cs
- TimersDescriptionAttribute.cs
- EmissiveMaterial.cs
- ListCollectionView.cs
- MachineKeySection.cs
- CodeExpressionCollection.cs
- BoolLiteral.cs
- Positioning.cs
- DiscoveryOperationContextExtension.cs
- IdnElement.cs
- DoubleCollection.cs
- JsonDeserializer.cs
- Marshal.cs
- BitConverter.cs
- XmlDataSourceView.cs
- QilNode.cs
- Point3DCollection.cs
- ExtenderControl.cs
- SelectedDatesCollection.cs
- safePerfProviderHandle.cs
- PathFigureCollectionValueSerializer.cs
- Triangle.cs
- LinearGradientBrush.cs
- AnimationStorage.cs
- ToolStripDropTargetManager.cs
- IsolatedStorageFilePermission.cs
- ImageConverter.cs
- JsonServiceDocumentSerializer.cs
- CommentEmitter.cs
- _SecureChannel.cs
- MaterialCollection.cs
- _SecureChannel.cs
- ObjectIDGenerator.cs
- FlowPanelDesigner.cs
- TagPrefixInfo.cs
- ConstraintStruct.cs
- ClassHandlersStore.cs
- SizeAnimationUsingKeyFrames.cs
- Vector3DIndependentAnimationStorage.cs
- Tracking.cs
- MaterialGroup.cs
- SizeAnimation.cs
- TypeDescriptionProvider.cs
- ModelTreeEnumerator.cs
- DependencyPropertyKind.cs
- Line.cs
- OleDbRowUpdatedEvent.cs
- DesignTableCollection.cs
- MultiplexingDispatchMessageFormatter.cs
- HtmlGenericControl.cs
- VerticalAlignConverter.cs