Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Collections / CompatibleComparer.cs / 1305376 / CompatibleComparer.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== //[....] // using System.Diagnostics.Contracts; 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"); } Contract.EndContractBlock(); 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ToolStripContentPanelRenderEventArgs.cs
- XmlCompatibilityReader.cs
- MimeTypePropertyAttribute.cs
- SafeWaitHandle.cs
- ConfigUtil.cs
- OutputChannel.cs
- BamlTreeNode.cs
- DataServiceEntityAttribute.cs
- GridSplitterAutomationPeer.cs
- DefaultTextStore.cs
- TransactionContextManager.cs
- TripleDESCryptoServiceProvider.cs
- SerializationHelper.cs
- HtmlLink.cs
- CollectionBase.cs
- DBAsyncResult.cs
- NetSectionGroup.cs
- SecurityElement.cs
- httpstaticobjectscollection.cs
- ConfigXmlDocument.cs
- Rotation3DKeyFrameCollection.cs
- Timer.cs
- AffineTransform3D.cs
- RegexReplacement.cs
- ComponentResourceKey.cs
- MdiWindowListStrip.cs
- AnnotationResourceChangedEventArgs.cs
- FunctionQuery.cs
- TextTreeText.cs
- LogRestartAreaEnumerator.cs
- HtmlGenericControl.cs
- GlyphsSerializer.cs
- SHA512.cs
- RenderContext.cs
- ObjectViewListener.cs
- XmlSchemaAny.cs
- CalendarDay.cs
- ColumnTypeConverter.cs
- DocumentSequenceHighlightLayer.cs
- RawTextInputReport.cs
- MenuItemStyleCollection.cs
- MarkupExtensionReturnTypeAttribute.cs
- BooleanToVisibilityConverter.cs
- Int16.cs
- FlatButtonAppearance.cs
- StoryFragments.cs
- TimeEnumHelper.cs
- RadialGradientBrush.cs
- Quad.cs
- AdornerHitTestResult.cs
- ExpressionNode.cs
- ActiveXHost.cs
- CreateDataSourceDialog.cs
- CommandEventArgs.cs
- HyperLinkColumn.cs
- Line.cs
- Form.cs
- XmlSchemaGroupRef.cs
- BigInt.cs
- Msmq4SubqueuePoisonHandler.cs
- InputMethodStateTypeInfo.cs
- OperatingSystem.cs
- DescendentsWalker.cs
- DbInsertCommandTree.cs
- HashHelpers.cs
- TextPatternIdentifiers.cs
- WeakReference.cs
- _UriSyntax.cs
- CodeMemberEvent.cs
- TaskForm.cs
- SynchronizationLockException.cs
- DragEventArgs.cs
- WindowsServiceElement.cs
- RadioButtonAutomationPeer.cs
- CompressEmulationStream.cs
- DispatcherProcessingDisabled.cs
- TimeSpanConverter.cs
- EpmTargetTree.cs
- DropDownList.cs
- SiteMapNodeItem.cs
- SudsParser.cs
- ResourceBinder.cs
- CommandPlan.cs
- IntegerFacetDescriptionElement.cs
- EdmScalarPropertyAttribute.cs
- DesignerSerializationVisibilityAttribute.cs
- SoapInteropTypes.cs
- RuntimeArgumentHandle.cs
- XDeferredAxisSource.cs
- TemplateKeyConverter.cs
- ToolStripGripRenderEventArgs.cs
- XmlIncludeAttribute.cs
- ColorConverter.cs
- JpegBitmapDecoder.cs
- WindowsGraphicsWrapper.cs
- SerializableAttribute.cs
- AtomEntry.cs
- WindowsMenu.cs
- DocumentViewerHelper.cs
- hresults.cs