Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / clr / src / BCL / System / Collections / CaseInsensitiveHashCodeProvider.cs / 1 / 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; [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"); } m_text = culture.TextInfo; } public static CaseInsensitiveHashCodeProvider Default { get { return new CaseInsensitiveHashCodeProvider(CultureInfo.CurrentCulture); } } public static CaseInsensitiveHashCodeProvider DefaultInvariant { get { 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"); } String s = obj as String; if (s==null) { return obj.GetHashCode(); } return m_text.GetCaseInsensitiveHashCode(s); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataBoundControlAdapter.cs
- FocusManager.cs
- RefreshPropertiesAttribute.cs
- RegisterResponseInfo.cs
- XmlSignificantWhitespace.cs
- TagMapInfo.cs
- CollectionContainer.cs
- WriteFileContext.cs
- WebPartEditorOkVerb.cs
- AsymmetricSignatureFormatter.cs
- ValidatingReaderNodeData.cs
- ExpressionBindingCollection.cs
- RegionInfo.cs
- Trace.cs
- DataGridPreparingCellForEditEventArgs.cs
- QualifiedCellIdBoolean.cs
- OneOfElement.cs
- XmlElementList.cs
- DataGridViewImageColumn.cs
- ErrorStyle.cs
- DataSourceConverter.cs
- EpmCustomContentDeSerializer.cs
- TransformProviderWrapper.cs
- UserControlParser.cs
- ItemDragEvent.cs
- ParameterModifier.cs
- KeyInterop.cs
- BoolLiteral.cs
- PartialTrustVisibleAssembly.cs
- TokenizerHelper.cs
- SqlCaseSimplifier.cs
- XmlSchemaAnnotation.cs
- DataGridViewCellCancelEventArgs.cs
- DispatcherExceptionFilterEventArgs.cs
- MainMenu.cs
- OwnerDrawPropertyBag.cs
- ButtonChrome.cs
- assertwrapper.cs
- SchemaImporterExtensionsSection.cs
- ClientSideQueueItem.cs
- FixedFindEngine.cs
- EventDrivenDesigner.cs
- LinearGradientBrush.cs
- DataFieldEditor.cs
- BindingWorker.cs
- TableLayoutSettings.cs
- BaseParser.cs
- Function.cs
- TrustManagerPromptUI.cs
- RequiredAttributeAttribute.cs
- TreeViewTemplateSelector.cs
- ResourceBinder.cs
- SecurityPermission.cs
- infer.cs
- PassportIdentity.cs
- FrameworkContextData.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- oledbmetadatacollectionnames.cs
- Stroke2.cs
- Accessors.cs
- ObjectStateFormatter.cs
- TypeInfo.cs
- HttpWebResponse.cs
- FontWeight.cs
- GroupDescription.cs
- AutoSizeComboBox.cs
- KeyInfo.cs
- PenLineCapValidation.cs
- ComplusEndpointConfigContainer.cs
- HMACSHA1.cs
- MatrixConverter.cs
- DocumentNUp.cs
- UiaCoreTypesApi.cs
- CustomAttributeSerializer.cs
- TextElementEditingBehaviorAttribute.cs
- SystemResources.cs
- GridLengthConverter.cs
- MultipleViewPatternIdentifiers.cs
- MemberBinding.cs
- ClientProxyGenerator.cs
- OutputChannel.cs
- Vector3DAnimationUsingKeyFrames.cs
- TableCell.cs
- SqlTransaction.cs
- SqlConnectionPoolGroupProviderInfo.cs
- X509Chain.cs
- PersistChildrenAttribute.cs
- FormViewUpdatedEventArgs.cs
- ComPlusDiagnosticTraceRecords.cs
- KeyTime.cs
- RowVisual.cs
- ListView.cs
- BitmapEffectGroup.cs
- SHA256Managed.cs
- XhtmlBasicTextViewAdapter.cs
- LicenseManager.cs
- DiagnosticsElement.cs
- TemplateKey.cs
- ProviderException.cs
- CodeNamespaceCollection.cs