Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Collections / CompatibleComparer.cs / 1305376 / CompatibleComparer.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== //[....] // using System.Diagnostics.Contracts; 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"); } Contract.EndContractBlock(); 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ServiceManager.cs
- X509PeerCertificateAuthenticationElement.cs
- FontInfo.cs
- TaskExceptionHolder.cs
- SqlTriggerAttribute.cs
- EntityParameterCollection.cs
- SmiEventSink_Default.cs
- ReflectPropertyDescriptor.cs
- Int64Storage.cs
- ProcessModelSection.cs
- NCryptNative.cs
- XsdValidatingReader.cs
- CallbackValidatorAttribute.cs
- RenderCapability.cs
- TemplatePagerField.cs
- XmlDataProvider.cs
- Condition.cs
- Pair.cs
- EllipseGeometry.cs
- NetStream.cs
- EnumBuilder.cs
- RsaSecurityTokenParameters.cs
- HttpServerChannel.cs
- ProfileParameter.cs
- BinaryFormatterWriter.cs
- ConfigDefinitionUpdates.cs
- SectionUpdates.cs
- ZipIOExtraFieldElement.cs
- TextParagraphProperties.cs
- TemplateField.cs
- FlowDocumentScrollViewer.cs
- UIntPtr.cs
- Expressions.cs
- WindowsUserNameSecurityTokenAuthenticator.cs
- RegistrySecurity.cs
- SqlPersonalizationProvider.cs
- FieldAccessException.cs
- AutoGeneratedField.cs
- SystemIPGlobalStatistics.cs
- EncryptedKey.cs
- SmtpNegotiateAuthenticationModule.cs
- ObjectDataSource.cs
- DataGridViewTextBoxEditingControl.cs
- FamilyTypeface.cs
- SortedList.cs
- HtmlGenericControl.cs
- SqlCommandAsyncResult.cs
- ColorAnimationBase.cs
- XmlQueryCardinality.cs
- XmlNamedNodeMap.cs
- FilteredDataSetHelper.cs
- CollectionConverter.cs
- PublisherIdentityPermission.cs
- EventLogPermissionAttribute.cs
- FlowDocumentReader.cs
- IntermediatePolicyValidator.cs
- DataColumnMappingCollection.cs
- SocketPermission.cs
- DataTemplateSelector.cs
- SchemaSetCompiler.cs
- TextTreeFixupNode.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- SettingsPropertyValueCollection.cs
- DbParameterHelper.cs
- HGlobalSafeHandle.cs
- WindowsTreeView.cs
- ZipArchive.cs
- AttributeProviderAttribute.cs
- DbFunctionCommandTree.cs
- BaseCodePageEncoding.cs
- StatusBarPanelClickEvent.cs
- FixedLineResult.cs
- AnnotationMap.cs
- FileAuthorizationModule.cs
- SortedList.cs
- SortedList.cs
- LogicalExpressionEditor.cs
- ProviderUtil.cs
- HostProtectionException.cs
- StringDictionary.cs
- MenuAutomationPeer.cs
- XomlDesignerLoader.cs
- EmptyArray.cs
- SafeCoTaskMem.cs
- ServicePointManager.cs
- TimerEventSubscriptionCollection.cs
- ButtonFieldBase.cs
- SettingsPropertyValue.cs
- WebPartMinimizeVerb.cs
- SortedList.cs
- loginstatus.cs
- AuthenticationService.cs
- SiteMapSection.cs
- IdleTimeoutMonitor.cs
- PolyBezierSegment.cs
- EmulateRecognizeCompletedEventArgs.cs
- InvokeMethodActivity.cs
- DefaultExpressionVisitor.cs
- StringStorage.cs
- AddInActivator.cs