Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- ProcessInputEventArgs.cs
- TextDecorations.cs
- SecurityProtocolCorrelationState.cs
- DynamicPhysicalDiscoSearcher.cs
- EventPrivateKey.cs
- ToolStripArrowRenderEventArgs.cs
- StyleXamlParser.cs
- rsa.cs
- CodeDomComponentSerializationService.cs
- TemplatedMailWebEventProvider.cs
- ExpressionVisitor.cs
- CodeTypeDeclarationCollection.cs
- WebPartManager.cs
- ChtmlFormAdapter.cs
- WebPartHelpVerb.cs
- FormsAuthentication.cs
- SelectionRange.cs
- LexicalChunk.cs
- GenericUriParser.cs
- DATA_BLOB.cs
- Screen.cs
- InternalRelationshipCollection.cs
- SelectionItemPattern.cs
- PrivilegeNotHeldException.cs
- TextServicesCompartment.cs
- InstanceNormalEvent.cs
- BuiltInExpr.cs
- PasswordRecoveryAutoFormat.cs
- _LoggingObject.cs
- WaitHandleCannotBeOpenedException.cs
- SatelliteContractVersionAttribute.cs
- XmlSchemaExternal.cs
- TrackingDataItemValue.cs
- ImageField.cs
- OleDbError.cs
- PolyQuadraticBezierSegment.cs
- PersonalizationProvider.cs
- TimeSpanStorage.cs
- BitSet.cs
- InputBinder.cs
- FontStyle.cs
- DescendantOverDescendantQuery.cs
- TreeNodeClickEventArgs.cs
- TypedTableBaseExtensions.cs
- SQLInt32Storage.cs
- AsnEncodedData.cs
- SecurityTimestamp.cs
- ExportFileRequest.cs
- Animatable.cs
- AssemblyAssociatedContentFileAttribute.cs
- _ShellExpression.cs
- EntityDataSourceDataSelectionPanel.cs
- UnsettableComboBox.cs
- List.cs
- DetailsViewRowCollection.cs
- QueryAccessibilityHelpEvent.cs
- SqlUtil.cs
- GenericsInstances.cs
- CodeMethodReturnStatement.cs
- BindingListCollectionView.cs
- ScrollProperties.cs
- SafeEventLogWriteHandle.cs
- tibetanshape.cs
- ReplyChannel.cs
- XPathDocumentBuilder.cs
- Dictionary.cs
- AspCompat.cs
- TrackingMemoryStream.cs
- PackageProperties.cs
- OrthographicCamera.cs
- OleDbParameter.cs
- SQLCharsStorage.cs
- VersionedStream.cs
- DetailsViewAutoFormat.cs
- XPathNodeHelper.cs
- Button.cs
- PolyLineSegmentFigureLogic.cs
- Number.cs
- ValueTable.cs
- HtmlTableRow.cs
- HostedTransportConfigurationBase.cs
- ImageField.cs
- DoubleConverter.cs
- StyleModeStack.cs
- baseshape.cs
- DataTableMapping.cs
- VisualBasicSettingsConverter.cs
- StrongNameKeyPair.cs
- xmlglyphRunInfo.cs
- StorageEndPropertyMapping.cs
- RuntimeIdentifierPropertyAttribute.cs
- SoapCommonClasses.cs
- Identity.cs
- AsmxEndpointPickerExtension.cs
- IncomingWebRequestContext.cs
- CompiledIdentityConstraint.cs
- ValidationSummary.cs
- TrackBarDesigner.cs
- sqlpipe.cs
- CompilationUnit.cs