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
- ProvidePropertyAttribute.cs
- ChtmlCalendarAdapter.cs
- TypedElement.cs
- DataColumnMappingCollection.cs
- ScriptIgnoreAttribute.cs
- AspNetSynchronizationContext.cs
- ServiceReference.cs
- HttpSessionStateWrapper.cs
- SmtpCommands.cs
- DataGridViewAutoSizeModeEventArgs.cs
- ByteFacetDescriptionElement.cs
- SingleObjectCollection.cs
- DbProviderSpecificTypePropertyAttribute.cs
- DetailsViewInsertedEventArgs.cs
- AsyncResult.cs
- ZipIOExtraFieldZip64Element.cs
- ScrollChrome.cs
- DataGridAutoFormatDialog.cs
- Utilities.cs
- StreamGeometry.cs
- CmsUtils.cs
- X509Utils.cs
- DefaultValueConverter.cs
- DefaultEventAttribute.cs
- StateChangeEvent.cs
- LinqDataSourceValidationException.cs
- WorkflowDurableInstance.cs
- InkCanvasInnerCanvas.cs
- PageCatalogPartDesigner.cs
- WindowVisualStateTracker.cs
- CompositeActivityCodeGenerator.cs
- DataServiceQueryOfT.cs
- XamlTypeMapper.cs
- FixedElement.cs
- datacache.cs
- InfoCardMasterKey.cs
- AssociationEndMember.cs
- MULTI_QI.cs
- DbCommandDefinition.cs
- PointLightBase.cs
- MenuScrollingVisibilityConverter.cs
- HttpListenerElement.cs
- TaskbarItemInfo.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- SelectionRangeConverter.cs
- Set.cs
- HandleRef.cs
- SiteOfOriginContainer.cs
- ListBindingHelper.cs
- serverconfig.cs
- RSAOAEPKeyExchangeFormatter.cs
- DbUpdateCommandTree.cs
- KeyManager.cs
- EventPropertyMap.cs
- VScrollProperties.cs
- CookieParameter.cs
- DataGridItemEventArgs.cs
- RelationshipConstraintValidator.cs
- Condition.cs
- GridViewRow.cs
- SQLByteStorage.cs
- XmlSchemaImport.cs
- BitmapDecoder.cs
- SqlVersion.cs
- SyntaxCheck.cs
- PointAnimationClockResource.cs
- SafeRightsManagementQueryHandle.cs
- ListViewUpdatedEventArgs.cs
- BindingExpressionUncommonField.cs
- ElementHostAutomationPeer.cs
- SqlNodeAnnotations.cs
- GifBitmapDecoder.cs
- QueryContinueDragEventArgs.cs
- TrackBar.cs
- Util.cs
- Blend.cs
- ContentTextAutomationPeer.cs
- DataIdProcessor.cs
- TableProviderWrapper.cs
- RegisteredArrayDeclaration.cs
- OperationInfoBase.cs
- NamespaceQuery.cs
- SystemTcpConnection.cs
- TextTreeExtractElementUndoUnit.cs
- PassportIdentity.cs
- Viewport3DAutomationPeer.cs
- IgnoreFileBuildProvider.cs
- EntityDataSourceSelectedEventArgs.cs
- UInt64.cs
- CheckBoxFlatAdapter.cs
- ListViewTableRow.cs
- SelectionRangeConverter.cs
- SqlCharStream.cs
- SearchForVirtualItemEventArgs.cs
- XmlSchemaSet.cs
- SID.cs
- GrammarBuilderBase.cs
- GroupBoxAutomationPeer.cs
- ParameterInfo.cs
- NullableBoolConverter.cs