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
- HostedElements.cs
- arabicshape.cs
- DataObject.cs
- WebPartDisplayMode.cs
- UriParserTemplates.cs
- EntityContainerEntitySetDefiningQuery.cs
- ToolStripCustomTypeDescriptor.cs
- _BaseOverlappedAsyncResult.cs
- TableLayoutRowStyleCollection.cs
- ChineseLunisolarCalendar.cs
- XmlAggregates.cs
- Image.cs
- EndEvent.cs
- CodeTypeDelegate.cs
- X509ChainPolicy.cs
- ScrollBar.cs
- UIElementAutomationPeer.cs
- HttpContextServiceHost.cs
- MissingSatelliteAssemblyException.cs
- CompilerErrorCollection.cs
- PageTrueTypeFont.cs
- VirtualDirectoryMapping.cs
- SafeNativeMethodsCLR.cs
- MimeTypePropertyAttribute.cs
- XmlDataProvider.cs
- followingquery.cs
- StaticTextPointer.cs
- CompressEmulationStream.cs
- OleDbInfoMessageEvent.cs
- MultipartContentParser.cs
- TransactionFilter.cs
- XmlName.cs
- BufferedStream.cs
- SeverityFilter.cs
- CannotUnloadAppDomainException.cs
- StringWriter.cs
- PeerCollaborationPermission.cs
- Utility.cs
- BasicHttpBinding.cs
- CodeAttributeArgumentCollection.cs
- OracleString.cs
- ViewLoader.cs
- LongTypeConverter.cs
- MailAddress.cs
- TypeResolver.cs
- basecomparevalidator.cs
- WindowsPen.cs
- ProcessManager.cs
- ILGenerator.cs
- WindowsEditBoxRange.cs
- FontConverter.cs
- XhtmlStyleClass.cs
- SimpleTableProvider.cs
- SerializationException.cs
- DrawListViewColumnHeaderEventArgs.cs
- X509AsymmetricSecurityKey.cs
- categoryentry.cs
- IsolationInterop.cs
- ConfigXmlCDataSection.cs
- HotSpotCollection.cs
- RegisteredDisposeScript.cs
- ProfileGroupSettingsCollection.cs
- MessagePartProtectionMode.cs
- UrlMapping.cs
- FontSource.cs
- Pair.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- CannotUnloadAppDomainException.cs
- Crc32.cs
- ServiceSecurityContext.cs
- BitmapEffectGroup.cs
- CounterCreationDataCollection.cs
- Simplifier.cs
- PersonalizableAttribute.cs
- Model3D.cs
- BulletedListEventArgs.cs
- TextPatternIdentifiers.cs
- SettingsProperty.cs
- DataContract.cs
- SiteIdentityPermission.cs
- ServiceModelExtensionElement.cs
- DBCSCodePageEncoding.cs
- AsymmetricCryptoHandle.cs
- PropertyDescriptor.cs
- ExpressionCopier.cs
- FlowLayoutSettings.cs
- ActiveXSite.cs
- WaveHeader.cs
- Menu.cs
- BlurBitmapEffect.cs
- ToggleProviderWrapper.cs
- DatagridviewDisplayedBandsData.cs
- WebBrowserBase.cs
- XmlSchemaSimpleTypeRestriction.cs
- SecurityHeaderLayout.cs
- BlockExpression.cs
- Evidence.cs
- EventRoute.cs
- TabItem.cs
- Stack.cs