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
- DelimitedListTraceListener.cs
- SessionParameter.cs
- Int64.cs
- FixedSOMGroup.cs
- TextBoxBase.cs
- BrowserCapabilitiesFactoryBase.cs
- EntityDataSourceMemberPath.cs
- Variant.cs
- TreeBuilderBamlTranslator.cs
- wmiprovider.cs
- FontFamilyValueSerializer.cs
- DictionaryEntry.cs
- LocationUpdates.cs
- ContextProperty.cs
- IndicFontClient.cs
- ClrProviderManifest.cs
- TraceEventCache.cs
- NameObjectCollectionBase.cs
- TextBreakpoint.cs
- IDQuery.cs
- ToggleProviderWrapper.cs
- SQLCharsStorage.cs
- MatrixTransform.cs
- PasswordRecovery.cs
- InvokeBase.cs
- CodeMethodInvokeExpression.cs
- Translator.cs
- CellTreeNode.cs
- EncryptedKey.cs
- NativeRecognizer.cs
- DuplicateWaitObjectException.cs
- ExceptionHandler.cs
- ComponentDispatcherThread.cs
- DataConnectionHelper.cs
- DataSourceHelper.cs
- OdbcHandle.cs
- StreamResourceInfo.cs
- Viewport3DAutomationPeer.cs
- RuntimeArgumentHandle.cs
- ExecutionContext.cs
- SafeEventLogWriteHandle.cs
- ObjectTokenCategory.cs
- ScriptServiceAttribute.cs
- SqlLiftWhereClauses.cs
- ColumnProvider.cs
- BasicHttpSecurityElement.cs
- DictionaryManager.cs
- ListBoxItem.cs
- X509ClientCertificateCredentialsElement.cs
- ActivityDesigner.cs
- HelpEvent.cs
- storepermission.cs
- DropShadowEffect.cs
- ListParagraph.cs
- RecognizerInfo.cs
- RepeaterCommandEventArgs.cs
- SystemColors.cs
- QueryContinueDragEvent.cs
- BuildProvider.cs
- EntityContainerRelationshipSet.cs
- ImageBrush.cs
- BaseParaClient.cs
- ResourceProviderFactory.cs
- DateTimeOffset.cs
- PageThemeBuildProvider.cs
- SpellerError.cs
- IriParsingElement.cs
- WpfGeneratedKnownProperties.cs
- SimplePropertyEntry.cs
- SoapDocumentServiceAttribute.cs
- EventSchemaTraceListener.cs
- SelectingProviderEventArgs.cs
- RuntimeConfigLKG.cs
- SqlDataSourceConfigureFilterForm.cs
- GeneralTransform2DTo3D.cs
- DbCommandDefinition.cs
- Context.cs
- DataSvcMapFile.cs
- ValueTable.cs
- XmlHelper.cs
- HitTestParameters3D.cs
- WsdlEndpointConversionContext.cs
- DefaultValueAttribute.cs
- BitStream.cs
- DeobfuscatingStream.cs
- Timer.cs
- ListViewDeleteEventArgs.cs
- BindingCompleteEventArgs.cs
- ComponentCollection.cs
- ContextConfiguration.cs
- SupportsEventValidationAttribute.cs
- SystemSounds.cs
- HtmlHead.cs
- BindingExpression.cs
- AsyncOperationManager.cs
- TraceSource.cs
- HttpContext.cs
- HelpInfo.cs
- Currency.cs
- UseLicense.cs