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
- TextTreeUndo.cs
- ImmutableObjectAttribute.cs
- CodeMemberEvent.cs
- FlowDocumentFormatter.cs
- DataViewSettingCollection.cs
- FlowDocument.cs
- PointAnimation.cs
- ReadOnlyDictionary.cs
- ServicePointManagerElement.cs
- TreeViewImageIndexConverter.cs
- BrowserCapabilitiesFactory.cs
- Model3DGroup.cs
- ProcessThreadDesigner.cs
- MatrixTransform.cs
- AutomationPropertyInfo.cs
- StylusEditingBehavior.cs
- precedingsibling.cs
- KeyFrames.cs
- SizeF.cs
- Part.cs
- Calendar.cs
- SqlUtils.cs
- ApplicationFileParser.cs
- StatusBarPanelClickEvent.cs
- SoundPlayer.cs
- ActivationArguments.cs
- TextModifier.cs
- ColumnMapTranslator.cs
- TabControl.cs
- PersonalizationStateQuery.cs
- PackageFilter.cs
- EntityClientCacheEntry.cs
- SecurityUniqueId.cs
- ToolStripOverflow.cs
- TimeSpanSecondsConverter.cs
- MsdtcClusterUtils.cs
- PreloadedPackages.cs
- StateItem.cs
- StringCollectionEditor.cs
- TemplateBindingExpression.cs
- XmlWriterTraceListener.cs
- shaperfactoryquerycachekey.cs
- StreamGeometry.cs
- ContentElement.cs
- PropertyChange.cs
- UIPermission.cs
- SafeFileMappingHandle.cs
- CharacterString.cs
- ExpressionVisitorHelpers.cs
- KerberosSecurityTokenProvider.cs
- InterleavedZipPartStream.cs
- CssStyleCollection.cs
- webeventbuffer.cs
- HScrollProperties.cs
- DeclarativeCatalogPartDesigner.cs
- AttributeCollection.cs
- ScriptDescriptor.cs
- ByteRangeDownloader.cs
- SpellCheck.cs
- DiscoveryOperationContextExtension.cs
- OutputChannel.cs
- DomNameTable.cs
- StorageMappingFragment.cs
- ExpressionCopier.cs
- PageBreakRecord.cs
- OleCmdHelper.cs
- BitmapImage.cs
- XmlILStorageConverter.cs
- WorkflowFileItem.cs
- DetailsViewInsertedEventArgs.cs
- RecordManager.cs
- NativeRightsManagementAPIsStructures.cs
- WebPartMovingEventArgs.cs
- ChannelPoolSettingsElement.cs
- Lease.cs
- ProxyWebPart.cs
- XmlParser.cs
- TabItem.cs
- ComplexObject.cs
- TdsParserSessionPool.cs
- TemplateInstanceAttribute.cs
- PageHandlerFactory.cs
- ServiceDocument.cs
- ApplicationFileParser.cs
- NullExtension.cs
- VerificationException.cs
- RTLAwareMessageBox.cs
- ValueUtilsSmi.cs
- HttpsTransportElement.cs
- WindowShowOrOpenTracker.cs
- PointAnimationBase.cs
- BitFlagsGenerator.cs
- NamespaceImport.cs
- NativeActivityMetadata.cs
- OleCmdHelper.cs
- AppSettingsReader.cs
- ConditionBrowserDialog.cs
- ToolStripItemRenderEventArgs.cs
- TemplateBaseAction.cs
- ChooseAction.cs