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
- DataControlImageButton.cs
- ToolStripArrowRenderEventArgs.cs
- ScriptManagerProxy.cs
- ParentQuery.cs
- XmlSchemaComplexContentExtension.cs
- SqlTopReducer.cs
- ToolBarDesigner.cs
- HttpEncoderUtility.cs
- SchemaAttDef.cs
- EntityDataSourceUtil.cs
- DataGridColumn.cs
- XMLDiffLoader.cs
- ObjectNavigationPropertyMapping.cs
- ConvertEvent.cs
- AppModelKnownContentFactory.cs
- UnSafeCharBuffer.cs
- ListViewInsertEventArgs.cs
- AutoCompleteStringCollection.cs
- Activator.cs
- SemaphoreFullException.cs
- TextAdaptor.cs
- Pair.cs
- VisualStyleInformation.cs
- ToolStripLocationCancelEventArgs.cs
- ScriptMethodAttribute.cs
- BinaryReader.cs
- SingleAnimationBase.cs
- UInt64Storage.cs
- SettingsProviderCollection.cs
- PageRanges.cs
- LineServices.cs
- GenericFlowSwitchHelper.cs
- CompressedStack.cs
- OleDbPropertySetGuid.cs
- XpsFixedDocumentReaderWriter.cs
- StrokeNodeOperations2.cs
- ComAwareEventInfo.cs
- ConfigurationPermission.cs
- MissingMethodException.cs
- wgx_render.cs
- CustomExpression.cs
- SequentialUshortCollection.cs
- UriScheme.cs
- RenameRuleObjectDialog.Designer.cs
- ServiceDiscoveryBehavior.cs
- X509CertificateClaimSet.cs
- EnumMemberAttribute.cs
- OleDbStruct.cs
- XamlGridLengthSerializer.cs
- ContourSegment.cs
- SessionParameter.cs
- SchemaNames.cs
- OletxTransactionManager.cs
- selecteditemcollection.cs
- PasswordBoxAutomationPeer.cs
- HttpProfileGroupBase.cs
- DBAsyncResult.cs
- ListViewCancelEventArgs.cs
- DataKeyArray.cs
- PersonalizableTypeEntry.cs
- ExceptionWrapper.cs
- SafeCoTaskMem.cs
- SamlAuthorityBinding.cs
- DataGridViewComboBoxColumn.cs
- DataGridViewCellStyleBuilderDialog.cs
- DataControlFieldCell.cs
- WebRequestModuleElement.cs
- FieldInfo.cs
- RegistryDataKey.cs
- ResourceContainerWrapper.cs
- GridItemPatternIdentifiers.cs
- RSAPKCS1SignatureDeformatter.cs
- TextAdaptor.cs
- CookieProtection.cs
- ChangeProcessor.cs
- SelectionListComponentEditor.cs
- ObjectAssociationEndMapping.cs
- SystemResourceHost.cs
- _HelperAsyncResults.cs
- ExpandedWrapper.cs
- SqlBulkCopy.cs
- OleDbException.cs
- WSSecureConversation.cs
- SmiEventSink.cs
- WorkflowItemsPresenter.cs
- CompareValidator.cs
- CollectionType.cs
- NameNode.cs
- TextSelectionProcessor.cs
- Trigger.cs
- ValidationError.cs
- NotImplementedException.cs
- SimpleType.cs
- ListParaClient.cs
- RemotingAttributes.cs
- FixedBufferAttribute.cs
- WebPartConnectVerb.cs
- PreparingEnlistment.cs
- DbDeleteCommandTree.cs
- EventSinkHelperWriter.cs