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
- ZipPackage.cs
- CredentialCache.cs
- TextTreeInsertElementUndoUnit.cs
- ColorIndependentAnimationStorage.cs
- GroupQuery.cs
- CheckBoxFlatAdapter.cs
- XsltFunctions.cs
- autovalidator.cs
- TreeNode.cs
- AutomationPatternInfo.cs
- SplitterPanel.cs
- DataGridParentRows.cs
- TextEditorLists.cs
- GridViewCancelEditEventArgs.cs
- PageBreakRecord.cs
- Buffer.cs
- ConnectionManagementSection.cs
- DataGridViewColumnEventArgs.cs
- XmlSerializerFactory.cs
- ArgumentNullException.cs
- ToolTip.cs
- IsolationInterop.cs
- PopupEventArgs.cs
- DynamicQueryableWrapper.cs
- WeakReferenceEnumerator.cs
- ToolStripDropDownClosingEventArgs.cs
- TreeNodeMouseHoverEvent.cs
- WindowsServiceElement.cs
- ResourceContainerWrapper.cs
- Accessors.cs
- CompressEmulationStream.cs
- RectValueSerializer.cs
- StateManagedCollection.cs
- SafeFileMappingHandle.cs
- Transactions.cs
- ColumnPropertiesGroup.cs
- ToolStripDropDownButton.cs
- GatewayIPAddressInformationCollection.cs
- ListContractAdapter.cs
- CaseStatement.cs
- OleDbCommandBuilder.cs
- CheckBoxList.cs
- Composition.cs
- RepeatBehaviorConverter.cs
- SqlError.cs
- RegisteredScript.cs
- TypeSchema.cs
- RemotingService.cs
- InvariantComparer.cs
- AssemblyResolver.cs
- DodSequenceMerge.cs
- TemplateManager.cs
- IncrementalHitTester.cs
- DecimalAverageAggregationOperator.cs
- RelatedCurrencyManager.cs
- PerspectiveCamera.cs
- cryptoapiTransform.cs
- Select.cs
- BaseDataList.cs
- TextFormatter.cs
- IgnoreDeviceFilterElement.cs
- MimeParameters.cs
- IsolationInterop.cs
- SQLBoolean.cs
- StyleSelector.cs
- WizardPanelChangingEventArgs.cs
- DesignerImageAdapter.cs
- DataGridViewColumnEventArgs.cs
- GlyphTypeface.cs
- TemplateColumn.cs
- MergeFailedEvent.cs
- NativeMethodsCLR.cs
- AnnotationResourceCollection.cs
- DataRowExtensions.cs
- EventRoute.cs
- RoleGroupCollection.cs
- Base64Encoder.cs
- StrongName.cs
- DataGridViewRowCancelEventArgs.cs
- WebConfigurationHost.cs
- HandleCollector.cs
- ToolStripPanelRow.cs
- DocumentPageHost.cs
- SqlCommandBuilder.cs
- RadioButtonStandardAdapter.cs
- Misc.cs
- SessionState.cs
- PaintValueEventArgs.cs
- PackageDigitalSignatureManager.cs
- XmlTextAttribute.cs
- HostSecurityManager.cs
- BlockUIContainer.cs
- Emitter.cs
- NetworkInformationPermission.cs
- UnsafeNativeMethodsMilCoreApi.cs
- IProvider.cs
- GeneratedCodeAttribute.cs
- AttributeAction.cs
- HiddenFieldPageStatePersister.cs
- CachingHintValidation.cs