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
- DataGridAutomationPeer.cs
- Publisher.cs
- RadioButtonFlatAdapter.cs
- ItemCollection.cs
- CompositeDesignerAccessibleObject.cs
- DataGridColumnEventArgs.cs
- EntityClientCacheKey.cs
- OdbcDataReader.cs
- ClientBuildManagerCallback.cs
- BackgroundFormatInfo.cs
- BamlReader.cs
- TypeConverters.cs
- XmlMemberMapping.cs
- SqlRowUpdatingEvent.cs
- PresentationAppDomainManager.cs
- ActivityValidator.cs
- ImageListDesigner.cs
- FormCollection.cs
- XmlParserContext.cs
- DockAndAnchorLayout.cs
- List.cs
- BindingListCollectionView.cs
- CompilationLock.cs
- QuadraticBezierSegment.cs
- PropertyDescriptorCollection.cs
- ISAPIRuntime.cs
- UrlPath.cs
- SafeProcessHandle.cs
- SplashScreenNativeMethods.cs
- ApplicationHost.cs
- XmlDocumentType.cs
- PersistenceTypeAttribute.cs
- IdentityReference.cs
- XmlBinaryReader.cs
- DBAsyncResult.cs
- ReadOnlyHierarchicalDataSource.cs
- InstanceLockLostException.cs
- SessionIDManager.cs
- SecurityDescriptor.cs
- TableCellAutomationPeer.cs
- InternalCache.cs
- PostBackTrigger.cs
- XsdDuration.cs
- StorageSetMapping.cs
- Container.cs
- SiteMapNodeItem.cs
- IPPacketInformation.cs
- RepeaterItem.cs
- LocalizableResourceBuilder.cs
- DeploymentExceptionMapper.cs
- WeakHashtable.cs
- RecognizerBase.cs
- ISAPIApplicationHost.cs
- InternalTypeHelper.cs
- BehaviorEditorPart.cs
- HierarchicalDataBoundControl.cs
- bindurihelper.cs
- DataGridViewUtilities.cs
- SmtpDigestAuthenticationModule.cs
- LoginDesignerUtil.cs
- SafeViewOfFileHandle.cs
- IHttpResponseInternal.cs
- ToolStripPanelRow.cs
- OleCmdHelper.cs
- remotingproxy.cs
- KeysConverter.cs
- ScaleTransform.cs
- BamlVersionHeader.cs
- CapabilitiesAssignment.cs
- EventSetter.cs
- MsmqHostedTransportConfiguration.cs
- InvariantComparer.cs
- InstanceKey.cs
- MarshalByRefObject.cs
- WebBrowserSiteBase.cs
- DataSourceCacheDurationConverter.cs
- ApplicationException.cs
- WpfWebRequestHelper.cs
- CustomLineCap.cs
- PartitionResolver.cs
- ServiceReflector.cs
- BaseCollection.cs
- _HeaderInfo.cs
- WmlLiteralTextAdapter.cs
- DeclaredTypeElement.cs
- FileLogRecordStream.cs
- Propagator.JoinPropagator.cs
- Slider.cs
- OpacityConverter.cs
- StateChangeEvent.cs
- ScrollChangedEventArgs.cs
- LabelDesigner.cs
- TimersDescriptionAttribute.cs
- Avt.cs
- SchemaRegistration.cs
- DataGridViewMethods.cs
- SqlNodeAnnotation.cs
- SqlFacetAttribute.cs
- HorizontalAlignConverter.cs
- KeyConverter.cs