Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / clr / src / BCL / System / Collections / CompatibleComparer.cs / 1 / CompatibleComparer.cs
namespace System.Collections { [Serializable()] internal class CompatibleComparer: IEqualityComparer { IComparer _comparer; #pragma warning disable 618 IHashCodeProvider _hcp; internal CompatibleComparer(IComparer comparer, IHashCodeProvider hashCodeProvider) { _comparer = comparer; _hcp = hashCodeProvider; } #pragma warning restore 618 public int Compare(Object a, Object b) { if (a == b) return 0; if (a == null) return -1; if (b == null) return 1; if (_comparer != null) return _comparer.Compare(a,b); IComparable ia = a as IComparable; if (ia != null) return ia.CompareTo(b); throw new ArgumentException(Environment.GetResourceString("Argument_ImplementIComparable")); } public new bool Equals(Object a, Object b) { return Compare(a, b) == 0; } public int GetHashCode(Object obj) { if( obj == null) { throw new ArgumentNullException("obj"); } if (_hcp != null) return _hcp.GetHashCode(obj); return obj.GetHashCode(); } // These are helpers for the Hashtable to query the IKeyComparer infrastructure. internal IComparer Comparer { get { return _comparer; } } // These are helpers for the Hashtable to query the IKeyComparer infrastructure. #pragma warning disable 618 internal IHashCodeProvider HashCodeProvider { get { return _hcp; } } #pragma warning restore 618 } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. namespace System.Collections { [Serializable()] internal class CompatibleComparer: IEqualityComparer { IComparer _comparer; #pragma warning disable 618 IHashCodeProvider _hcp; internal CompatibleComparer(IComparer comparer, IHashCodeProvider hashCodeProvider) { _comparer = comparer; _hcp = hashCodeProvider; } #pragma warning restore 618 public int Compare(Object a, Object b) { if (a == b) return 0; if (a == null) return -1; if (b == null) return 1; if (_comparer != null) return _comparer.Compare(a,b); IComparable ia = a as IComparable; if (ia != null) return ia.CompareTo(b); throw new ArgumentException(Environment.GetResourceString("Argument_ImplementIComparable")); } public new bool Equals(Object a, Object b) { return Compare(a, b) == 0; } public int GetHashCode(Object obj) { if( obj == null) { throw new ArgumentNullException("obj"); } if (_hcp != null) return _hcp.GetHashCode(obj); return obj.GetHashCode(); } // These are helpers for the Hashtable to query the IKeyComparer infrastructure. internal IComparer Comparer { get { return _comparer; } } // These are helpers for the Hashtable to query the IKeyComparer infrastructure. #pragma warning disable 618 internal IHashCodeProvider HashCodeProvider { get { return _hcp; } } #pragma warning restore 618 } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- GridViewRowPresenter.cs
- DocumentSchemaValidator.cs
- PeerFlooder.cs
- AnimationException.cs
- CurrentTimeZone.cs
- AccessKeyManager.cs
- HotSpot.cs
- SafeCryptContextHandle.cs
- ColumnTypeConverter.cs
- BypassElement.cs
- FontWeights.cs
- XPathAxisIterator.cs
- PlanCompilerUtil.cs
- SrgsDocumentParser.cs
- ColorIndependentAnimationStorage.cs
- SqlNotificationRequest.cs
- EventLogPermission.cs
- FileEnumerator.cs
- XPathSingletonIterator.cs
- ExpressionNormalizer.cs
- TcpTransportBindingElement.cs
- BeginCreateSecurityTokenRequest.cs
- StatusBarDesigner.cs
- WebPartExportVerb.cs
- ClosableStream.cs
- GeneralTransform.cs
- CellIdBoolean.cs
- DesignRelationCollection.cs
- DataGridColumnHeaderCollection.cs
- LifetimeServices.cs
- NotifyParentPropertyAttribute.cs
- WindowsFormsLinkLabel.cs
- MetadataSource.cs
- RoleGroup.cs
- JsonGlobals.cs
- CompilationUnit.cs
- WebPartDeleteVerb.cs
- PointHitTestResult.cs
- XmlAttributes.cs
- VisualTreeHelper.cs
- DisplayMemberTemplateSelector.cs
- Matrix.cs
- MimeTypeMapper.cs
- DataViewManagerListItemTypeDescriptor.cs
- CompositeFontParser.cs
- TableLayoutRowStyleCollection.cs
- ProfileProvider.cs
- TemplateControl.cs
- ComponentResourceKey.cs
- SignedXmlDebugLog.cs
- DeflateEmulationStream.cs
- PageRouteHandler.cs
- KeyTimeConverter.cs
- AmbiguousMatchException.cs
- TargetPerspective.cs
- ContentHostHelper.cs
- HMACSHA1.cs
- Composition.cs
- AssemblyHash.cs
- InputEventArgs.cs
- DeviceSpecific.cs
- WebPartHelpVerb.cs
- TimerTable.cs
- ListenerBinder.cs
- MappedMetaModel.cs
- XmlCountingReader.cs
- Process.cs
- TrustSection.cs
- graph.cs
- InputLanguageCollection.cs
- SQLDecimal.cs
- Multiply.cs
- Crc32Helper.cs
- InternalResources.cs
- WindowPatternIdentifiers.cs
- CodeDelegateCreateExpression.cs
- WebPartManager.cs
- AggregationMinMaxHelpers.cs
- StyleBamlRecordReader.cs
- DbProviderFactory.cs
- HealthMonitoringSection.cs
- PrintDialog.cs
- XamlPoint3DCollectionSerializer.cs
- TransactionInformation.cs
- UshortList2.cs
- Span.cs
- AppDomainShutdownMonitor.cs
- UnsafeNativeMethodsCLR.cs
- PopupRootAutomationPeer.cs
- HttpResponseInternalWrapper.cs
- DbConnectionStringCommon.cs
- CSharpCodeProvider.cs
- AdRotator.cs
- GeometryGroup.cs
- UnsafeMethods.cs
- DataTableCollection.cs
- IfAction.cs
- SkewTransform.cs
- TextElementCollection.cs
- DrawingCollection.cs