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
- EmptyEnumerator.cs
- smtpconnection.cs
- WebContext.cs
- Timer.cs
- RSAPKCS1KeyExchangeFormatter.cs
- DecimalAnimation.cs
- TypeEnumerableViewSchema.cs
- InternalConfigSettingsFactory.cs
- InputEventArgs.cs
- DataGridViewHitTestInfo.cs
- BindingSource.cs
- MembershipPasswordException.cs
- ToolStripDesignerUtils.cs
- DatePickerAutomationPeer.cs
- Application.cs
- TraceHandlerErrorFormatter.cs
- Single.cs
- XmlSchemaProviderAttribute.cs
- EventRecord.cs
- ModelVisual3D.cs
- AnnotationDocumentPaginator.cs
- TextServicesHost.cs
- ObjectStorage.cs
- XmlQueryRuntime.cs
- RestHandlerFactory.cs
- DocumentReference.cs
- BinaryObjectInfo.cs
- InputLanguageProfileNotifySink.cs
- PropertyMap.cs
- Selection.cs
- NodeFunctions.cs
- ColumnTypeConverter.cs
- ImageSource.cs
- ButtonChrome.cs
- DataKeyArray.cs
- CanonicalizationDriver.cs
- SiteMapNodeCollection.cs
- WsatTransactionInfo.cs
- shaper.cs
- KeySpline.cs
- BufferedGraphicsContext.cs
- DispatcherOperation.cs
- MSAAEventDispatcher.cs
- WindowsScrollBar.cs
- EmptyCollection.cs
- Array.cs
- CacheModeValueSerializer.cs
- ObjectDataSourceStatusEventArgs.cs
- XpsInterleavingPolicy.cs
- Logging.cs
- Int64.cs
- FormsAuthenticationConfiguration.cs
- SystemException.cs
- ChangeNode.cs
- SqlConnectionFactory.cs
- TypeForwardedToAttribute.cs
- SoapObjectWriter.cs
- UnknownBitmapEncoder.cs
- HierarchicalDataBoundControl.cs
- AddressUtility.cs
- HttpWebResponse.cs
- WmfPlaceableFileHeader.cs
- SerializationEventsCache.cs
- TextParentUndoUnit.cs
- ConnectionPointCookie.cs
- coordinator.cs
- SqlRecordBuffer.cs
- SQLRoleProvider.cs
- FixedSOMContainer.cs
- ListViewPagedDataSource.cs
- WizardStepBase.cs
- Vector3dCollection.cs
- GeometryModel3D.cs
- LinkAreaEditor.cs
- FormatPage.cs
- ListenUriMode.cs
- DrawingVisualDrawingContext.cs
- XPathNodeInfoAtom.cs
- NavigatingCancelEventArgs.cs
- ICspAsymmetricAlgorithm.cs
- HostElement.cs
- XmlWellformedWriterHelpers.cs
- PopupEventArgs.cs
- ServiceDescriptionContext.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- ErrorStyle.cs
- OutputScopeManager.cs
- CodeGeneratorOptions.cs
- MouseGestureValueSerializer.cs
- File.cs
- DictionaryKeyPropertyAttribute.cs
- StringStorage.cs
- SqlUserDefinedTypeAttribute.cs
- SpecialFolderEnumConverter.cs
- RayMeshGeometry3DHitTestResult.cs
- DataContractJsonSerializer.cs
- EventDescriptorCollection.cs
- OdbcDataReader.cs
- NullEntityWrapper.cs
- LocatorGroup.cs