Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- _SslState.cs
- DataPagerFieldCommandEventArgs.cs
- BamlBinaryReader.cs
- UIElement.cs
- StringOutput.cs
- InputReport.cs
- CustomCredentialPolicy.cs
- OlePropertyStructs.cs
- ViewStateException.cs
- PropertyIDSet.cs
- EditingMode.cs
- EndpointReference.cs
- MetadataAssemblyHelper.cs
- Utils.cs
- LinqDataSourceValidationException.cs
- TemplateBaseAction.cs
- Context.cs
- ADConnectionHelper.cs
- TypeDescriptionProvider.cs
- TimeSpanConverter.cs
- Point3DIndependentAnimationStorage.cs
- DataSourceConverter.cs
- EntityViewGenerationConstants.cs
- HGlobalSafeHandle.cs
- ContainerActivationHelper.cs
- ValueChangedEventManager.cs
- XamlInt32CollectionSerializer.cs
- SecurityTokenParameters.cs
- iisPickupDirectory.cs
- TargetPerspective.cs
- BatchParser.cs
- CircleHotSpot.cs
- AdornerPresentationContext.cs
- TreeIterators.cs
- PointCollectionConverter.cs
- SimpleWebHandlerParser.cs
- PageRequestManager.cs
- HttpFormatExtensions.cs
- Helpers.cs
- DataGridViewRow.cs
- ProofTokenCryptoHandle.cs
- DataRow.cs
- XPathDescendantIterator.cs
- SurrogateSelector.cs
- SelectionPatternIdentifiers.cs
- EmptyImpersonationContext.cs
- SQLDouble.cs
- WrappingXamlSchemaContext.cs
- xmlsaver.cs
- FormsIdentity.cs
- ProfileEventArgs.cs
- TextElement.cs
- DataServiceQueryOfT.cs
- XmlSiteMapProvider.cs
- ToolboxDataAttribute.cs
- Screen.cs
- ConditionCollection.cs
- ApplicationManager.cs
- CheckBoxList.cs
- DataRow.cs
- MbpInfo.cs
- ListBase.cs
- ConstrainedGroup.cs
- HostedElements.cs
- UnorderedHashRepartitionStream.cs
- InfoCardBaseException.cs
- AnnotationStore.cs
- ClientWindowsAuthenticationMembershipProvider.cs
- AvTrace.cs
- ContextInformation.cs
- ThicknessAnimation.cs
- Source.cs
- CollectionType.cs
- FunctionCommandText.cs
- MediaPlayer.cs
- GlyphInfoList.cs
- SpecularMaterial.cs
- WebPartUserCapability.cs
- ApplicationSecurityManager.cs
- MenuItemBinding.cs
- AppSecurityManager.cs
- SqlColumnizer.cs
- HashAlgorithm.cs
- StreamReader.cs
- PrimitiveDataContract.cs
- Reference.cs
- ArgIterator.cs
- WebDisplayNameAttribute.cs
- RuntimeWrappedException.cs
- AdornerDecorator.cs
- MimeTypeMapper.cs
- ConfigurationStrings.cs
- DataReceivedEventArgs.cs
- StructuredType.cs
- WebControlParameterProxy.cs
- HtmlWindowCollection.cs
- SqlClientPermission.cs
- SynchronizationContext.cs
- FrameworkContentElement.cs
- AxWrapperGen.cs