Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Debug.cs
- TreeViewImageIndexConverter.cs
- AVElementHelper.cs
- ListViewCommandEventArgs.cs
- BamlLocalizer.cs
- LookupNode.cs
- XmlSchema.cs
- EntityDescriptor.cs
- SqlConnectionManager.cs
- DataListComponentEditor.cs
- RecordsAffectedEventArgs.cs
- DeobfuscatingStream.cs
- FrameworkRichTextComposition.cs
- OdbcRowUpdatingEvent.cs
- Directory.cs
- MasterPageCodeDomTreeGenerator.cs
- RijndaelManaged.cs
- InputScopeConverter.cs
- Automation.cs
- AssemblyInfo.cs
- EllipseGeometry.cs
- DataGridTextBox.cs
- XhtmlBasicSelectionListAdapter.cs
- RegexStringValidatorAttribute.cs
- DynamicRenderer.cs
- XmlQueryTypeFactory.cs
- PersonalizationStateQuery.cs
- ObjectStateEntry.cs
- Filter.cs
- ImmutableAssemblyCacheEntry.cs
- PerfCounterSection.cs
- ColumnProvider.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- RemotingConfiguration.cs
- UrlAuthFailedErrorFormatter.cs
- SqlClientWrapperSmiStreamChars.cs
- TableItemPattern.cs
- EntityDataSource.cs
- PartialArray.cs
- PropertyToken.cs
- WebPartEventArgs.cs
- EventMappingSettingsCollection.cs
- TrackingRecordPreFilter.cs
- SqlProcedureAttribute.cs
- DocumentReferenceCollection.cs
- OleDbFactory.cs
- KerberosTicketHashIdentifierClause.cs
- MulticastIPAddressInformationCollection.cs
- Int32AnimationUsingKeyFrames.cs
- Collection.cs
- SqlConnection.cs
- Quaternion.cs
- OracleCommandSet.cs
- DataObjectSettingDataEventArgs.cs
- ReadOnlyCollection.cs
- GeneralTransform3D.cs
- DescriptionCreator.cs
- ContentPlaceHolderDesigner.cs
- ArrayElementGridEntry.cs
- EncoderReplacementFallback.cs
- FixUpCollection.cs
- DataGridViewCellEventArgs.cs
- TypedElement.cs
- BrowserCapabilitiesFactory.cs
- wgx_sdk_version.cs
- TaskExtensions.cs
- basevalidator.cs
- PathSegment.cs
- Int16.cs
- XmlSerializationReader.cs
- ClientFormsIdentity.cs
- HttpWebRequestElement.cs
- InternalControlCollection.cs
- DoubleLinkList.cs
- XpsSerializationManager.cs
- MemoryStream.cs
- ListViewTableRow.cs
- StandardBindingOptionalReliableSessionElement.cs
- ObjectStateEntryDbDataRecord.cs
- DBDataPermission.cs
- URLAttribute.cs
- RemoteHelper.cs
- PreProcessInputEventArgs.cs
- BitConverter.cs
- ObjectHandle.cs
- DictionaryGlobals.cs
- QilLiteral.cs
- PartialCachingAttribute.cs
- DataGridViewToolTip.cs
- IndexingContentUnit.cs
- CodeConstructor.cs
- DbConnectionFactory.cs
- WMICapabilities.cs
- DataTablePropertyDescriptor.cs
- VectorAnimationUsingKeyFrames.cs
- X509KeyIdentifierClauseType.cs
- CharacterBufferReference.cs
- KeyPressEvent.cs
- DbProviderFactories.cs
- ComponentDesigner.cs