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
- DocumentApplicationJournalEntry.cs
- ExpressionConverter.cs
- GridItemPattern.cs
- TextUtf8RawTextWriter.cs
- XmlSchemaValidationException.cs
- TextWriterEngine.cs
- SecurityContext.cs
- HtmlEncodedRawTextWriter.cs
- SmtpTransport.cs
- DataServiceRequestException.cs
- SqlDataSourceView.cs
- ConfigurationValue.cs
- SimpleApplicationHost.cs
- ColorAnimationUsingKeyFrames.cs
- MouseActionValueSerializer.cs
- UnsafeNativeMethods.cs
- ProcessingInstructionAction.cs
- SystemIcmpV6Statistics.cs
- TextEditorTyping.cs
- InvariantComparer.cs
- DesignerAttribute.cs
- TemplateParser.cs
- GeneralTransformGroup.cs
- GenericEnumerator.cs
- TraceContextRecord.cs
- MatrixCamera.cs
- MailHeaderInfo.cs
- QualifiedCellIdBoolean.cs
- InvokeProviderWrapper.cs
- ExceptionUtil.cs
- TemplateFactory.cs
- BuildResultCache.cs
- XmlElementAttributes.cs
- ImageIndexConverter.cs
- X509KeyIdentifierClauseType.cs
- MatrixTransform3D.cs
- FormsAuthenticationEventArgs.cs
- TextSerializer.cs
- Bold.cs
- Automation.cs
- AspNetHostingPermission.cs
- ViewValidator.cs
- AppDomainProtocolHandler.cs
- NotFiniteNumberException.cs
- FileNotFoundException.cs
- ImportContext.cs
- BinaryEditor.cs
- MaterialCollection.cs
- Pens.cs
- StreamWriter.cs
- ConfigurationStrings.cs
- ResourceExpressionBuilder.cs
- DataGridViewHeaderCell.cs
- Encoder.cs
- TransportOutputChannel.cs
- ConnectionPointCookie.cs
- ToolStripContentPanel.cs
- ObjectDataSourceFilteringEventArgs.cs
- UpdateProgress.cs
- InheritanceAttribute.cs
- HttpListenerContext.cs
- MatcherBuilder.cs
- PassportAuthenticationModule.cs
- DataGridViewCell.cs
- DesignerActionItem.cs
- IisTraceListener.cs
- RelationshipManager.cs
- cache.cs
- Grammar.cs
- DataObjectPastingEventArgs.cs
- XmlHelper.cs
- AttachedPropertiesService.cs
- GridItemProviderWrapper.cs
- DocumentViewerHelper.cs
- _PooledStream.cs
- SoapIgnoreAttribute.cs
- ProofTokenCryptoHandle.cs
- XMLSchema.cs
- NonParentingControl.cs
- DataGridViewCellPaintingEventArgs.cs
- XmlSchemaDatatype.cs
- DataGridViewRowCollection.cs
- ImageDesigner.cs
- BitmapEffectrendercontext.cs
- XmlILAnnotation.cs
- GridViewUpdatedEventArgs.cs
- Site.cs
- SafeNativeMethods.cs
- DataColumnChangeEvent.cs
- BinaryMessageFormatter.cs
- FontSizeConverter.cs
- DataList.cs
- latinshape.cs
- StringArrayEditor.cs
- HelpFileFileNameEditor.cs
- MetadataCache.cs
- ListViewItemSelectionChangedEvent.cs
- Package.cs
- BuildManager.cs
- SafeNativeMethods.cs