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
- NetDataContractSerializer.cs
- FormsAuthenticationModule.cs
- ReadOnlyObservableCollection.cs
- WebPartVerb.cs
- PageAsyncTaskManager.cs
- DocumentPageHost.cs
- HttpCookie.cs
- DataGridViewCellStateChangedEventArgs.cs
- ClientConfigPaths.cs
- LinqMaximalSubtreeNominator.cs
- ColorAnimationBase.cs
- QuaternionConverter.cs
- PrintController.cs
- ForwardPositionQuery.cs
- IProvider.cs
- DrawingAttributes.cs
- VisualTreeHelper.cs
- Configuration.cs
- DataBindingHandlerAttribute.cs
- DBCommand.cs
- DropDownHolder.cs
- XmlCharCheckingWriter.cs
- StackBuilderSink.cs
- ObfuscationAttribute.cs
- ConfigXmlCDataSection.cs
- AspNetSynchronizationContext.cs
- EnumConverter.cs
- HttpModuleCollection.cs
- ViewGenResults.cs
- XMLUtil.cs
- MobileCapabilities.cs
- HttpCookie.cs
- WebFormsRootDesigner.cs
- XmlAttributeCache.cs
- FormClosingEvent.cs
- NetStream.cs
- DataGridViewDesigner.cs
- HtmlAnchor.cs
- SqlPersonalizationProvider.cs
- COM2ExtendedUITypeEditor.cs
- IUnknownConstantAttribute.cs
- XsdValidatingReader.cs
- TextEffect.cs
- WmpBitmapEncoder.cs
- RC2.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- DrawItemEvent.cs
- TemplateGroupCollection.cs
- DataSourceDesigner.cs
- DataException.cs
- WorkflowApplicationTerminatedException.cs
- NodeFunctions.cs
- SqlUtils.cs
- Site.cs
- XmlDataSource.cs
- DataTablePropertyDescriptor.cs
- MappingMetadataHelper.cs
- SwitchElementsCollection.cs
- CallSiteBinder.cs
- UnsafeNativeMethods.cs
- SqlBulkCopyColumnMapping.cs
- CharacterShapingProperties.cs
- ColumnHeader.cs
- ProgressBarRenderer.cs
- ButtonFlatAdapter.cs
- MappedMetaModel.cs
- CollectionsUtil.cs
- TreeNodeMouseHoverEvent.cs
- XamlReaderHelper.cs
- ToolStripCollectionEditor.cs
- MultipleViewPattern.cs
- ButtonBase.cs
- AttributeAction.cs
- ToolStripSeparatorRenderEventArgs.cs
- GeneralTransformGroup.cs
- MasterPageBuildProvider.cs
- PropertyTab.cs
- StreamingContext.cs
- BindingValueChangedEventArgs.cs
- UrlPath.cs
- UnhandledExceptionEventArgs.cs
- BitmapEffectrendercontext.cs
- LongSumAggregationOperator.cs
- XmlSerializerAssemblyAttribute.cs
- FrameworkContentElementAutomationPeer.cs
- JournalEntry.cs
- Win32.cs
- EditingScope.cs
- DefaultValueMapping.cs
- MessageSecurityVersion.cs
- DbConnectionPoolIdentity.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- TextAnchor.cs
- SapiAttributeParser.cs
- WsdlImporterElementCollection.cs
- SmiXetterAccessMap.cs
- AxisAngleRotation3D.cs
- ProcessInputEventArgs.cs
- DataSysAttribute.cs
- TimerExtension.cs