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
- HttpCapabilitiesEvaluator.cs
- ThicknessConverter.cs
- RetrieveVirtualItemEventArgs.cs
- SimpleApplicationHost.cs
- CodeValidator.cs
- HttpDebugHandler.cs
- PartialTrustVisibleAssembly.cs
- AuditLogLocation.cs
- XamlBrushSerializer.cs
- DataContractSerializerOperationFormatter.cs
- Vector3DIndependentAnimationStorage.cs
- Quaternion.cs
- CompoundFileStreamReference.cs
- OwnerDrawPropertyBag.cs
- FormsAuthenticationConfiguration.cs
- HitTestResult.cs
- HtmlAnchor.cs
- DesignerVerb.cs
- KeyGesture.cs
- SQLResource.cs
- PreservationFileWriter.cs
- GroupItemAutomationPeer.cs
- FixedSOMGroup.cs
- FontNamesConverter.cs
- FontStretchConverter.cs
- CachedPathData.cs
- DoubleCollectionValueSerializer.cs
- TypedRowHandler.cs
- Events.cs
- DesignerFrame.cs
- FixedTextView.cs
- RuntimeWrappedException.cs
- ReadOnlyHierarchicalDataSourceView.cs
- ResourceBinder.cs
- RtfControls.cs
- SystemBrushes.cs
- ISSmlParser.cs
- VisualBrush.cs
- CompiledQuery.cs
- TypeRestriction.cs
- TextTreeUndoUnit.cs
- Symbol.cs
- AssemblyName.cs
- AssemblyHash.cs
- TransformerInfoCollection.cs
- XmlSortKeyAccumulator.cs
- SqlRowUpdatedEvent.cs
- SemanticBasicElement.cs
- TextTreeInsertUndoUnit.cs
- TransformCryptoHandle.cs
- _FtpDataStream.cs
- HttpDebugHandler.cs
- FileLogRecordHeader.cs
- RelOps.cs
- ObservableDictionary.cs
- MimeTypeAttribute.cs
- RankException.cs
- SourceLineInfo.cs
- DataGridViewRowCancelEventArgs.cs
- SystemTcpConnection.cs
- ReceiveContextCollection.cs
- DocumentsTrace.cs
- SelectionEditor.cs
- SoapEnumAttribute.cs
- IPipelineRuntime.cs
- ClientBuildManagerCallback.cs
- EraserBehavior.cs
- FileChangesMonitor.cs
- ParenthesizePropertyNameAttribute.cs
- ProgressiveCrcCalculatingStream.cs
- XmlSchemaAnnotation.cs
- WebUtil.cs
- PropertyEmitterBase.cs
- SafeCryptContextHandle.cs
- TypeReference.cs
- DropShadowBitmapEffect.cs
- SafeProcessHandle.cs
- MemoryPressure.cs
- OperatingSystem.cs
- Endpoint.cs
- SmtpTransport.cs
- Events.cs
- CollectionContainer.cs
- XmlnsCompatibleWithAttribute.cs
- CatalogPart.cs
- TraceHandlerErrorFormatter.cs
- SafeNativeMethodsMilCoreApi.cs
- _LazyAsyncResult.cs
- AppPool.cs
- OdbcErrorCollection.cs
- SHA512.cs
- StringResourceManager.cs
- XamlSerializerUtil.cs
- AnimationStorage.cs
- CloudCollection.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- COM2ExtendedUITypeEditor.cs
- SQLBinary.cs
- ReaderContextStackData.cs
- DEREncoding.cs