Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- FunctionImportElement.cs
- AutoResetEvent.cs
- ReaderWriterLock.cs
- TextDecoration.cs
- GridItemPatternIdentifiers.cs
- OleDbConnectionFactory.cs
- GeometryHitTestParameters.cs
- ParseElementCollection.cs
- ClientSettingsStore.cs
- PointAnimationUsingPath.cs
- HttpModuleActionCollection.cs
- SessionPageStateSection.cs
- AnnotationMap.cs
- Pkcs7Signer.cs
- MarkupCompilePass2.cs
- DataGridSortCommandEventArgs.cs
- SortDescription.cs
- XmlText.cs
- SubqueryTrackingVisitor.cs
- MethodExpr.cs
- X509SecurityTokenAuthenticator.cs
- ProcessHostFactoryHelper.cs
- ListView.cs
- CqlQuery.cs
- SoapServerMethod.cs
- dataobject.cs
- CfgParser.cs
- ConfigurationValidatorBase.cs
- Int16.cs
- WebResourceAttribute.cs
- WmlPageAdapter.cs
- IsolatedStorageFile.cs
- SecurityRuntime.cs
- ErasingStroke.cs
- ArglessEventHandlerProxy.cs
- EventSinkHelperWriter.cs
- CustomActivityDesigner.cs
- FreezableDefaultValueFactory.cs
- FormatterServicesNoSerializableCheck.cs
- SortableBindingList.cs
- TypedTableBase.cs
- UnhandledExceptionEventArgs.cs
- ScriptRef.cs
- MaskedTextBox.cs
- ApplicationActivator.cs
- HtmlWindowCollection.cs
- SqlProcedureAttribute.cs
- LabelDesigner.cs
- UnknownBitmapDecoder.cs
- PaginationProgressEventArgs.cs
- BufferAllocator.cs
- IisTraceWebEventProvider.cs
- Timer.cs
- controlskin.cs
- PropertyDescriptor.cs
- SafeCryptoHandles.cs
- DrawListViewSubItemEventArgs.cs
- Vector3D.cs
- ImpersonateTokenRef.cs
- FormViewActionList.cs
- DataGridViewLinkCell.cs
- XNameConverter.cs
- CompressedStack.cs
- VBCodeProvider.cs
- TcpServerChannel.cs
- PeerInvitationResponse.cs
- GenerateHelper.cs
- TableCell.cs
- RenderData.cs
- XPathNavigator.cs
- Internal.cs
- Fx.cs
- SiteMapDataSourceView.cs
- WorkflowOwnerAsyncResult.cs
- SiteMap.cs
- UnionCqlBlock.cs
- ContainerTracking.cs
- Matrix3DStack.cs
- TargetConverter.cs
- AutoGeneratedField.cs
- FixedSOMPageConstructor.cs
- Parser.cs
- BufferedStream2.cs
- PathStreamGeometryContext.cs
- CatchDesigner.xaml.cs
- InkCanvasSelection.cs
- TCPListener.cs
- NetPeerTcpBindingCollectionElement.cs
- CurrentChangedEventManager.cs
- columnmapfactory.cs
- UpDownBaseDesigner.cs
- WebBrowsableAttribute.cs
- TopClause.cs
- SessionState.cs
- AutomationPatternInfo.cs
- RSAOAEPKeyExchangeFormatter.cs
- TreeSet.cs
- ApplicationBuildProvider.cs
- LineProperties.cs
- ExtractedStateEntry.cs