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
- TrimSurroundingWhitespaceAttribute.cs
- RawAppCommandInputReport.cs
- SystemIPInterfaceStatistics.cs
- ListBindingHelper.cs
- XPathAncestorIterator.cs
- MaterializeFromAtom.cs
- PagesChangedEventArgs.cs
- SoapServerProtocol.cs
- UnSafeCharBuffer.cs
- MultiPartWriter.cs
- TypeDescriptionProviderAttribute.cs
- DataRecord.cs
- PackagePart.cs
- SQLBytes.cs
- Identity.cs
- SimpleNameService.cs
- AppSettingsExpressionEditor.cs
- X509Certificate2.cs
- XPathNavigator.cs
- StrokeNodeData.cs
- CorrelationTokenTypeConvertor.cs
- ObfuscateAssemblyAttribute.cs
- Int64AnimationUsingKeyFrames.cs
- DataGridTableCollection.cs
- FreezableDefaultValueFactory.cs
- InstancePersistenceCommand.cs
- IDQuery.cs
- ServicePointManagerElement.cs
- DataRelationPropertyDescriptor.cs
- WebPartUtil.cs
- InvalidProgramException.cs
- Clause.cs
- FunctionOverloadResolver.cs
- InvalidOperationException.cs
- DecimalMinMaxAggregationOperator.cs
- KeyBinding.cs
- DragAssistanceManager.cs
- MediaCommands.cs
- LOSFormatter.cs
- MetabaseSettingsIis7.cs
- InternalCache.cs
- Geometry.cs
- PipeSecurity.cs
- TreeChangeInfo.cs
- EdmRelationshipRoleAttribute.cs
- RtfControls.cs
- CriticalFileToken.cs
- AdCreatedEventArgs.cs
- DashStyles.cs
- LongSumAggregationOperator.cs
- FormsAuthenticationUserCollection.cs
- RowSpanVector.cs
- TextTabProperties.cs
- MaskedTextProvider.cs
- DesignerTextBoxAdapter.cs
- DbParameterCollection.cs
- WebResourceAttribute.cs
- QueryExtender.cs
- XmlComplianceUtil.cs
- ObjectStateEntry.cs
- DrawingGroup.cs
- XsltOutput.cs
- LogEntryHeaderv1Deserializer.cs
- FixedTextBuilder.cs
- EasingFunctionBase.cs
- Expander.cs
- BaseUriHelper.cs
- SQLBytes.cs
- SchemaElementLookUpTable.cs
- KeyboardDevice.cs
- GridViewEditEventArgs.cs
- ChangeInterceptorAttribute.cs
- XmlSignificantWhitespace.cs
- MemoryStream.cs
- DeflateEmulationStream.cs
- ConsumerConnectionPoint.cs
- RecordBuilder.cs
- InternalUserCancelledException.cs
- Triplet.cs
- TransportSecurityProtocol.cs
- PointHitTestResult.cs
- _ServiceNameStore.cs
- xdrvalidator.cs
- SigningCredentials.cs
- HttpRequestMessageProperty.cs
- ConnectionsZone.cs
- OrthographicCamera.cs
- TableProvider.cs
- ZipIOExtraFieldElement.cs
- HtmlShim.cs
- _ServiceNameStore.cs
- FunctionImportMapping.cs
- FixedSOMPageConstructor.cs
- RotationValidation.cs
- NamespaceMapping.cs
- UniqueCodeIdentifierScope.cs
- RestHandlerFactory.cs
- TypeSystemProvider.cs
- ProtocolsConfigurationEntry.cs
- TransformerInfo.cs