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
- ObjectListDesigner.cs
- Blend.cs
- ExtentJoinTreeNode.cs
- CodeEntryPointMethod.cs
- ObjectQueryProvider.cs
- FieldDescriptor.cs
- PropertySegmentSerializationProvider.cs
- SectionInput.cs
- EventWaitHandle.cs
- IDReferencePropertyAttribute.cs
- SHA256.cs
- MethodBuilderInstantiation.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- BindableTemplateBuilder.cs
- PartEditor.cs
- controlskin.cs
- ProfessionalColors.cs
- RoleGroupCollection.cs
- Int64AnimationBase.cs
- ObjectConverter.cs
- ErrorProvider.cs
- TraceXPathNavigator.cs
- RowToFieldTransformer.cs
- MailDefinition.cs
- NativeCppClassAttribute.cs
- NeutralResourcesLanguageAttribute.cs
- BindingCollectionElement.cs
- LassoHelper.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- InitializationEventAttribute.cs
- UiaCoreApi.cs
- Encoder.cs
- SqlDataSourceTableQuery.cs
- Helpers.cs
- TextBox.cs
- ResourceBinder.cs
- CodeDomComponentSerializationService.cs
- KeyPressEvent.cs
- SiteMapSection.cs
- UnknownBitmapEncoder.cs
- EntityFunctions.cs
- MarkupProperty.cs
- ChangePassword.cs
- XmlCollation.cs
- PageRanges.cs
- Animatable.cs
- RenderingEventArgs.cs
- Icon.cs
- TextDecorationCollectionConverter.cs
- SimpleTextLine.cs
- TargetPerspective.cs
- DriveNotFoundException.cs
- BinHexEncoder.cs
- UnsafeCollabNativeMethods.cs
- DataComponentMethodGenerator.cs
- ProfileSection.cs
- MessageQueuePermission.cs
- WindowsUpDown.cs
- TileModeValidation.cs
- EntityDataSourceUtil.cs
- SafeMemoryMappedFileHandle.cs
- RelationshipSet.cs
- KeyConstraint.cs
- XmlChoiceIdentifierAttribute.cs
- AttachedAnnotation.cs
- ImplicitInputBrush.cs
- ObjectDataSourceStatusEventArgs.cs
- TypeSystem.cs
- FillErrorEventArgs.cs
- DecoderBestFitFallback.cs
- HttpHandlerAction.cs
- ProgressBarRenderer.cs
- KnownTypeAttribute.cs
- SiteMapHierarchicalDataSourceView.cs
- bindurihelper.cs
- CorrelationManager.cs
- Positioning.cs
- XslVisitor.cs
- BaseDataList.cs
- SiteMapHierarchicalDataSourceView.cs
- CommandArguments.cs
- ThrowHelper.cs
- DisposableCollectionWrapper.cs
- OleDbEnumerator.cs
- DetailsViewUpdateEventArgs.cs
- BoundColumn.cs
- DispatcherOperation.cs
- PerspectiveCamera.cs
- ToolStripItemTextRenderEventArgs.cs
- Win32.cs
- TemplateLookupAction.cs
- ToolStripItemImageRenderEventArgs.cs
- BaseDataBoundControl.cs
- XPathNodeIterator.cs
- TransformerInfo.cs
- CodeTypeDeclarationCollection.cs
- InlineUIContainer.cs
- FreezableDefaultValueFactory.cs
- NameValuePermission.cs
- TreeBuilder.cs