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
- EntityDataSourceWrapper.cs
- SqlDataSourceCustomCommandEditor.cs
- ColumnResult.cs
- ProcessThreadCollection.cs
- RequestFactory.cs
- PageParserFilter.cs
- FirstMatchCodeGroup.cs
- RelatedPropertyManager.cs
- ModuleBuilderData.cs
- ProfileModule.cs
- SoapClientProtocol.cs
- OverrideMode.cs
- BlurBitmapEffect.cs
- MetricEntry.cs
- LazyTextWriterCreator.cs
- RoleGroupCollection.cs
- GridViewUpdatedEventArgs.cs
- OrderByQueryOptionExpression.cs
- RegularExpressionValidator.cs
- WebControlParameterProxy.cs
- ICollection.cs
- WorkflowRuntimeSection.cs
- NativeWindow.cs
- Decorator.cs
- SupportingTokenBindingElement.cs
- HierarchicalDataSourceConverter.cs
- CookieHandler.cs
- ResourceProperty.cs
- RC2CryptoServiceProvider.cs
- RSACryptoServiceProvider.cs
- XmlSerializerSection.cs
- TableLayoutPanel.cs
- FunctionQuery.cs
- KerberosSecurityTokenAuthenticator.cs
- SectionRecord.cs
- AudioException.cs
- XmlKeywords.cs
- RegionData.cs
- DbProviderSpecificTypePropertyAttribute.cs
- MenuItem.cs
- IRCollection.cs
- PersonalizablePropertyEntry.cs
- StringToken.cs
- CharAnimationBase.cs
- XmlWellformedWriterHelpers.cs
- AddingNewEventArgs.cs
- UmAlQuraCalendar.cs
- BufferModeSettings.cs
- EpmSyndicationContentSerializer.cs
- DefaultValueTypeConverter.cs
- ObjectListDesigner.cs
- AspNetHostingPermission.cs
- ListViewDeletedEventArgs.cs
- ChannelProtectionRequirements.cs
- StreamGeometry.cs
- WebControlAdapter.cs
- ObjectHandle.cs
- SHA256Cng.cs
- AsymmetricSignatureFormatter.cs
- IODescriptionAttribute.cs
- UrlMapping.cs
- MailDefinition.cs
- GeneralTransformGroup.cs
- DbSetClause.cs
- HttpsHostedTransportConfiguration.cs
- Int16AnimationBase.cs
- EdmTypeAttribute.cs
- DecimalAnimation.cs
- OdbcRowUpdatingEvent.cs
- DelegateBodyWriter.cs
- ConditionalAttribute.cs
- Operators.cs
- RangeValuePattern.cs
- TemplateBindingExtension.cs
- EditorPart.cs
- MeasureItemEvent.cs
- Oid.cs
- FilterEventArgs.cs
- EditorServiceContext.cs
- UnsafeNativeMethods.cs
- UnknownBitmapEncoder.cs
- HwndStylusInputProvider.cs
- TableAdapterManagerNameHandler.cs
- PersonalizationProvider.cs
- CorrelationManager.cs
- SecurityChannel.cs
- ScrollData.cs
- SqlTriggerContext.cs
- StreamWithDictionary.cs
- MailAddress.cs
- RIPEMD160Managed.cs
- RestHandlerFactory.cs
- StringFunctions.cs
- TextDecoration.cs
- WindowsToolbarItemAsMenuItem.cs
- InstanceDataCollectionCollection.cs
- PropertyEmitter.cs
- SHA1.cs
- ContentType.cs
- SQLUtility.cs