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
- mil_sdk_version.cs
- BooleanSwitch.cs
- _OSSOCK.cs
- TypefaceMap.cs
- CDSCollectionETWBCLProvider.cs
- SByteStorage.cs
- EventSetter.cs
- SevenBitStream.cs
- Rect3DValueSerializer.cs
- ElementsClipboardData.cs
- MetadataSection.cs
- RoleBoolean.cs
- ReflectionTypeLoadException.cs
- RepeatButtonAutomationPeer.cs
- TargetControlTypeCache.cs
- Label.cs
- ProgressBar.cs
- SetterBase.cs
- SessionParameter.cs
- NullableIntMinMaxAggregationOperator.cs
- UpdateManifestForBrowserApplication.cs
- ExtensionQuery.cs
- SqlDataSourceFilteringEventArgs.cs
- XmlLinkedNode.cs
- InputProcessorProfiles.cs
- ToolBarButtonClickEvent.cs
- TransformGroup.cs
- GenericXmlSecurityToken.cs
- BaseProcessor.cs
- GeneralTransform3DGroup.cs
- UriTemplateClientFormatter.cs
- ContentElement.cs
- Int16Animation.cs
- _Events.cs
- Ref.cs
- PageParser.cs
- DetectEofStream.cs
- DesignerWebPartChrome.cs
- SectionRecord.cs
- Attribute.cs
- WebPartCancelEventArgs.cs
- SqlBulkCopyColumnMapping.cs
- MailAddressCollection.cs
- ManagedFilter.cs
- RenderingBiasValidation.cs
- RelatedImageListAttribute.cs
- QilCloneVisitor.cs
- SystemIPv4InterfaceProperties.cs
- SimpleWebHandlerParser.cs
- ConstrainedDataObject.cs
- SqlTypeConverter.cs
- KeyboardDevice.cs
- ZipIOFileItemStream.cs
- XmlSchema.cs
- AuthorizationRule.cs
- Quaternion.cs
- ErrorFormatterPage.cs
- SqlDataSourceDesigner.cs
- Msec.cs
- LoginUtil.cs
- DateTimeSerializationSection.cs
- MetadataItemEmitter.cs
- ConfigurationSchemaErrors.cs
- CorruptingExceptionCommon.cs
- DisplayMemberTemplateSelector.cs
- ListView.cs
- DataSourceControlBuilder.cs
- OleDbFactory.cs
- WindowsIdentity.cs
- FullTextBreakpoint.cs
- XmlTypeMapping.cs
- SizeValueSerializer.cs
- HebrewNumber.cs
- ParameterCollection.cs
- XmlNotation.cs
- AttributeUsageAttribute.cs
- GridView.cs
- CLSCompliantAttribute.cs
- FlatButtonAppearance.cs
- UpdateException.cs
- DispatcherHooks.cs
- CreateUserErrorEventArgs.cs
- Bookmark.cs
- OperationPickerDialog.cs
- Hyperlink.cs
- CompositeFontInfo.cs
- GetTokenRequest.cs
- ModelItemExtensions.cs
- ToolbarAUtomationPeer.cs
- DataGridViewCellCollection.cs
- WsatStrings.cs
- NamedPipeProcessProtocolHandler.cs
- BaseHashHelper.cs
- WindowsFormsSectionHandler.cs
- InvalidProgramException.cs
- SoapFormatter.cs
- PageAsyncTask.cs
- CacheAxisQuery.cs
- OutputBuffer.cs
- ClassDataContract.cs