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
- EdmRelationshipNavigationPropertyAttribute.cs
- DbMetaDataCollectionNames.cs
- Thumb.cs
- ValueType.cs
- ByteFacetDescriptionElement.cs
- NativeMethods.cs
- AuthenticateEventArgs.cs
- StringKeyFrameCollection.cs
- EntityRecordInfo.cs
- XmlReflectionMember.cs
- Operators.cs
- Rect3DValueSerializer.cs
- SettingsPropertyCollection.cs
- IPAddress.cs
- DeploymentSectionCache.cs
- QueryOpeningEnumerator.cs
- PropertyEmitterBase.cs
- ActivationArguments.cs
- DecimalAnimationUsingKeyFrames.cs
- ClientBuildManager.cs
- DataGridViewRowPostPaintEventArgs.cs
- DbConnectionHelper.cs
- ChtmlTextWriter.cs
- Size3DValueSerializer.cs
- ObjectConverter.cs
- KnownIds.cs
- BaseValidatorDesigner.cs
- AnnotationHelper.cs
- FrameworkContentElementAutomationPeer.cs
- ContractInferenceHelper.cs
- Span.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- AuthenticationModuleElement.cs
- sqlser.cs
- TextBoxBase.cs
- DynamicPropertyHolder.cs
- RangeValidator.cs
- ObfuscationAttribute.cs
- XamlUtilities.cs
- backend.cs
- DataGridViewSelectedColumnCollection.cs
- BigInt.cs
- TripleDES.cs
- XmlAttributeOverrides.cs
- ReferenceList.cs
- RootProfilePropertySettingsCollection.cs
- InstanceData.cs
- UserValidatedEventArgs.cs
- TypeTypeConverter.cs
- OleServicesContext.cs
- Serializer.cs
- XmlEntityReference.cs
- SafeLibraryHandle.cs
- TextTreeFixupNode.cs
- SettingsContext.cs
- Tag.cs
- ProcessHostServerConfig.cs
- XmlReaderDelegator.cs
- Decoder.cs
- _UncName.cs
- WindowsStatusBar.cs
- RegisteredScript.cs
- WorkflowTransactionService.cs
- AttachmentCollection.cs
- RegisteredDisposeScript.cs
- ParenthesizePropertyNameAttribute.cs
- DisplayNameAttribute.cs
- SerializationFieldInfo.cs
- UTF8Encoding.cs
- PostBackOptions.cs
- ItemCheckEvent.cs
- StoragePropertyMapping.cs
- MailWriter.cs
- SqlClientWrapperSmiStream.cs
- XmlSortKey.cs
- EventMappingSettings.cs
- BlurBitmapEffect.cs
- ColorAnimationBase.cs
- CreateUserErrorEventArgs.cs
- GenericsInstances.cs
- DrawingImage.cs
- AdobeCFFWrapper.cs
- JoinQueryOperator.cs
- ParseNumbers.cs
- XmlStreamStore.cs
- HtmlInputFile.cs
- SignedInfo.cs
- DictionaryContent.cs
- Number.cs
- ServiceHttpHandlerFactory.cs
- CodeTypeConstructor.cs
- SkipQueryOptionExpression.cs
- Hex.cs
- SimpleRecyclingCache.cs
- GridViewRowEventArgs.cs
- ListBindingConverter.cs
- SecurityPermission.cs
- SourceFilter.cs
- ApplicationContext.cs
- ValidationPropertyAttribute.cs