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
- DataGridViewTopRowAccessibleObject.cs
- StylesEditorDialog.cs
- Module.cs
- AccessedThroughPropertyAttribute.cs
- SrgsSubset.cs
- BaseAsyncResult.cs
- AnnouncementEndpoint.cs
- TextPatternIdentifiers.cs
- SelectionProcessor.cs
- MsiStyleLogWriter.cs
- DeviceOverridableAttribute.cs
- FrameworkTemplate.cs
- InputBinder.cs
- RenderOptions.cs
- HistoryEventArgs.cs
- CompositeScriptReference.cs
- RelatedEnd.cs
- TimeSpanValidator.cs
- DataSourceHelper.cs
- DataGridViewColumnEventArgs.cs
- TraversalRequest.cs
- TextBoxBase.cs
- XamlToRtfParser.cs
- autovalidator.cs
- ArithmeticLiteral.cs
- Rectangle.cs
- UndoManager.cs
- UnitySerializationHolder.cs
- SoapAttributeOverrides.cs
- ConfigurationFileMap.cs
- XpsTokenContext.cs
- RSAPKCS1SignatureFormatter.cs
- AddressHeaderCollection.cs
- QilExpression.cs
- RecognizedPhrase.cs
- XmlnsCache.cs
- ScrollBar.cs
- XmlLinkedNode.cs
- GridViewCommandEventArgs.cs
- OleDbRowUpdatedEvent.cs
- InfoCardSymmetricAlgorithm.cs
- Socket.cs
- _ChunkParse.cs
- DefaultValidator.cs
- SplayTreeNode.cs
- SmtpClient.cs
- RegexCompilationInfo.cs
- ChannelSinkStacks.cs
- RadialGradientBrush.cs
- InkPresenter.cs
- CompilerTypeWithParams.cs
- XPathNodeInfoAtom.cs
- HyperLinkStyle.cs
- PenLineCapValidation.cs
- TabletDeviceInfo.cs
- grammarelement.cs
- ValidationRuleCollection.cs
- DataGridItemEventArgs.cs
- KeyFrames.cs
- BuildProvider.cs
- VirtualDirectoryMapping.cs
- Oid.cs
- ServiceCredentialsElement.cs
- BoundsDrawingContextWalker.cs
- PolyLineSegment.cs
- StateFinalizationDesigner.cs
- DeploymentExceptionMapper.cs
- SqlReferenceCollection.cs
- CompressStream.cs
- RestClientProxyHandler.cs
- MultiAsyncResult.cs
- SnapshotChangeTrackingStrategy.cs
- XmlSchemaComplexContent.cs
- IPPacketInformation.cs
- CngAlgorithm.cs
- DataSetSchema.cs
- DataViewManagerListItemTypeDescriptor.cs
- Application.cs
- SecurityDocument.cs
- UnmanagedMemoryStreamWrapper.cs
- EventRoute.cs
- Page.cs
- PageClientProxyGenerator.cs
- PageSettings.cs
- DoubleMinMaxAggregationOperator.cs
- DataGridColumnHeaderAutomationPeer.cs
- ConfigurationStrings.cs
- Emitter.cs
- ComAwareEventInfo.cs
- PolygonHotSpot.cs
- SynchronizationLockException.cs
- DocumentApplicationJournalEntry.cs
- ArrayConverter.cs
- PrivilegedConfigurationManager.cs
- CoTaskMemUnicodeSafeHandle.cs
- ConfigXmlReader.cs
- KeyConstraint.cs
- FormClosedEvent.cs
- HwndStylusInputProvider.cs
- OutputCacheSection.cs