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
- HitTestWithGeometryDrawingContextWalker.cs
- PropertyRef.cs
- ObjectPersistData.cs
- DrawListViewSubItemEventArgs.cs
- CaseDesigner.xaml.cs
- SecurityTokenResolver.cs
- SwitchElementsCollection.cs
- ToolStripSystemRenderer.cs
- NavigationHelper.cs
- New.cs
- XmlTextReader.cs
- ComPlusServiceHost.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- TextBoxBase.cs
- FontStretch.cs
- SecurityKeyIdentifier.cs
- Point3DCollection.cs
- FileCodeGroup.cs
- FindCompletedEventArgs.cs
- BitmapEffectrendercontext.cs
- _PooledStream.cs
- _BasicClient.cs
- GenerateTemporaryTargetAssembly.cs
- SQLBinary.cs
- KeyManager.cs
- TraceHelpers.cs
- DBConnectionString.cs
- Attributes.cs
- ContentElementCollection.cs
- AssociatedControlConverter.cs
- RIPEMD160.cs
- NamespaceQuery.cs
- AsyncOperationManager.cs
- coordinatorscratchpad.cs
- TargetParameterCountException.cs
- AccessControlEntry.cs
- FormattedTextSymbols.cs
- Renderer.cs
- XmlSchemaAnnotation.cs
- EndpointAddressMessageFilterTable.cs
- CapabilitiesRule.cs
- ControlPager.cs
- GenerateTemporaryTargetAssembly.cs
- OleDbErrorCollection.cs
- InheritablePropertyChangeInfo.cs
- SqlCharStream.cs
- odbcmetadatafactory.cs
- JobDuplex.cs
- UnmanagedMemoryAccessor.cs
- HtmlInputRadioButton.cs
- ControlBindingsCollection.cs
- ParallelDesigner.xaml.cs
- ValidationErrorEventArgs.cs
- ListMarkerSourceInfo.cs
- Typography.cs
- AllMembershipCondition.cs
- WindowsRichEditRange.cs
- BlurEffect.cs
- EntityKeyElement.cs
- XmlSchemaObject.cs
- Scanner.cs
- QueryServiceConfigHandle.cs
- LoginCancelEventArgs.cs
- XmlSerializerFormatAttribute.cs
- SkewTransform.cs
- TiffBitmapEncoder.cs
- Types.cs
- UnsafeNativeMethodsTablet.cs
- CollectionContainer.cs
- ConnectionPointGlyph.cs
- ValueTypeFixupInfo.cs
- DataServices.cs
- TreeView.cs
- TextSearch.cs
- AssemblyHash.cs
- Utils.cs
- DesignerVerb.cs
- DocumentAutomationPeer.cs
- UriWriter.cs
- MenuScrollingVisibilityConverter.cs
- HtmlElementErrorEventArgs.cs
- MetadataException.cs
- BrowserDefinitionCollection.cs
- XmlSchemaElement.cs
- RemoteWebConfigurationHostServer.cs
- MetadataArtifactLoaderComposite.cs
- PartBasedPackageProperties.cs
- EditorPartChrome.cs
- CultureInfoConverter.cs
- VirtualPathUtility.cs
- EnumType.cs
- DynamicMethod.cs
- BaseProcessor.cs
- AssemblyAssociatedContentFileAttribute.cs
- _NetRes.cs
- MulticastOption.cs
- BindingValueChangedEventArgs.cs
- BamlRecordWriter.cs
- DiscreteKeyFrames.cs
- WaveHeader.cs