Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Collections / CaseInsensitiveHashCodeProvider.cs / 1305376 / CaseInsensitiveHashCodeProvider.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: CaseInsensitiveHashCodeProvider ** **[....] ** ** ** Purpose: Designed to support hashtables which require ** case-insensitive behavior while still maintaining case, ** this provides an efficient mechanism for getting the ** hashcode of the string ignoring case. ** ** ============================================================*/ namespace System.Collections { //This class does not contain members and does not need to be serializable using System; using System.Collections; using System.Globalization; using System.Diagnostics.Contracts; [Serializable] [Obsolete("Please use StringComparer instead.")] [System.Runtime.InteropServices.ComVisible(true)] public class CaseInsensitiveHashCodeProvider : IHashCodeProvider { private TextInfo m_text; private static CaseInsensitiveHashCodeProvider m_InvariantCaseInsensitiveHashCodeProvider = null; public CaseInsensitiveHashCodeProvider() { m_text = CultureInfo.CurrentCulture.TextInfo; } public CaseInsensitiveHashCodeProvider(CultureInfo culture) { if (culture==null) { throw new ArgumentNullException("culture"); } Contract.EndContractBlock(); m_text = culture.TextInfo; } public static CaseInsensitiveHashCodeProvider Default { get { Contract.Ensures(Contract.Result() != null); return new CaseInsensitiveHashCodeProvider(CultureInfo.CurrentCulture); } } public static CaseInsensitiveHashCodeProvider DefaultInvariant { get { Contract.Ensures(Contract.Result () != null); if (m_InvariantCaseInsensitiveHashCodeProvider == null) { m_InvariantCaseInsensitiveHashCodeProvider = new CaseInsensitiveHashCodeProvider(CultureInfo.InvariantCulture); } return m_InvariantCaseInsensitiveHashCodeProvider; } } public int GetHashCode(Object obj) { if (obj==null) { throw new ArgumentNullException("obj"); } Contract.EndContractBlock(); String s = obj as String; if (s==null) { return obj.GetHashCode(); } return m_text.GetCaseInsensitiveHashCode(s); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: CaseInsensitiveHashCodeProvider ** ** [....] ** ** ** Purpose: Designed to support hashtables which require ** case-insensitive behavior while still maintaining case, ** this provides an efficient mechanism for getting the ** hashcode of the string ignoring case. ** ** ============================================================*/ namespace System.Collections { //This class does not contain members and does not need to be serializable using System; using System.Collections; using System.Globalization; using System.Diagnostics.Contracts; [Serializable] [Obsolete("Please use StringComparer instead.")] [System.Runtime.InteropServices.ComVisible(true)] public class CaseInsensitiveHashCodeProvider : IHashCodeProvider { private TextInfo m_text; private static CaseInsensitiveHashCodeProvider m_InvariantCaseInsensitiveHashCodeProvider = null; public CaseInsensitiveHashCodeProvider() { m_text = CultureInfo.CurrentCulture.TextInfo; } public CaseInsensitiveHashCodeProvider(CultureInfo culture) { if (culture==null) { throw new ArgumentNullException("culture"); } Contract.EndContractBlock(); m_text = culture.TextInfo; } public static CaseInsensitiveHashCodeProvider Default { get { Contract.Ensures(Contract.Result() != null); return new CaseInsensitiveHashCodeProvider(CultureInfo.CurrentCulture); } } public static CaseInsensitiveHashCodeProvider DefaultInvariant { get { Contract.Ensures(Contract.Result () != null); if (m_InvariantCaseInsensitiveHashCodeProvider == null) { m_InvariantCaseInsensitiveHashCodeProvider = new CaseInsensitiveHashCodeProvider(CultureInfo.InvariantCulture); } return m_InvariantCaseInsensitiveHashCodeProvider; } } public int GetHashCode(Object obj) { if (obj==null) { throw new ArgumentNullException("obj"); } Contract.EndContractBlock(); String s = obj as String; if (s==null) { return obj.GetHashCode(); } return m_text.GetCaseInsensitiveHashCode(s); } } } // 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
- DoWorkEventArgs.cs
- DataContractJsonSerializer.cs
- TypedTableHandler.cs
- ExceptionList.cs
- LookupNode.cs
- ProcessModelSection.cs
- ListBoxItem.cs
- MailAddressParser.cs
- Transform3DGroup.cs
- HtmlInputFile.cs
- BitVec.cs
- ButtonColumn.cs
- GeometryGroup.cs
- StatusBar.cs
- DrawingGroupDrawingContext.cs
- ObjectStateFormatter.cs
- MetadataProperty.cs
- NavigationWindow.cs
- WebPartRestoreVerb.cs
- ActivityUtilities.cs
- WebPartManager.cs
- ConstrainedDataObject.cs
- BaseParaClient.cs
- OrderByQueryOptionExpression.cs
- ModelUIElement3D.cs
- SwitchAttribute.cs
- OdbcParameterCollection.cs
- SlotInfo.cs
- DocumentOrderQuery.cs
- CacheAxisQuery.cs
- BinHexDecoder.cs
- RelatedView.cs
- Border.cs
- StorageAssociationSetMapping.cs
- AssemblyBuilder.cs
- AdRotator.cs
- UInt64.cs
- HtmlInputSubmit.cs
- DockPatternIdentifiers.cs
- SecurityDocument.cs
- CaretElement.cs
- PropertiesTab.cs
- propertytag.cs
- CodeDefaultValueExpression.cs
- SizeF.cs
- InfoCardCryptoHelper.cs
- HtmlTable.cs
- PtsPage.cs
- CultureInfo.cs
- TreeBuilder.cs
- EdmEntityTypeAttribute.cs
- BaseProcessor.cs
- ExceptionWrapper.cs
- _ProxyRegBlob.cs
- DesignerDataStoredProcedure.cs
- ScaleTransform.cs
- X509SecurityTokenAuthenticator.cs
- GorillaCodec.cs
- MultiByteCodec.cs
- XpsS0ValidatingLoader.cs
- GridViewUpdatedEventArgs.cs
- LocalizableResourceBuilder.cs
- ComponentCollection.cs
- TypeResolver.cs
- FixedMaxHeap.cs
- ProgramNode.cs
- SchemaNamespaceManager.cs
- SafeSystemMetrics.cs
- SelectedPathEditor.cs
- ExpressionBindingCollection.cs
- GridViewRowPresenterBase.cs
- SecurityElement.cs
- ConnectionsZone.cs
- MediaPlayerState.cs
- NativeMsmqMessage.cs
- DragEventArgs.cs
- XPathParser.cs
- ListMarkerSourceInfo.cs
- RelationshipType.cs
- DtdParser.cs
- CodeTypeParameter.cs
- _emptywebproxy.cs
- CodeAttributeArgument.cs
- JpegBitmapEncoder.cs
- DeclarativeCatalogPart.cs
- WebPartDescriptionCollection.cs
- CrossAppDomainChannel.cs
- RuntimeIdentifierPropertyAttribute.cs
- Membership.cs
- updateconfighost.cs
- ExcCanonicalXml.cs
- GlobalEventManager.cs
- WorkflowViewElement.cs
- SystemKeyConverter.cs
- Convert.cs
- MappingMetadataHelper.cs
- HandlerBase.cs
- SubMenuStyleCollection.cs
- BitStack.cs
- Window.cs