Code:
/ FX-1434 / FX-1434 / 1.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
- CompilerInfo.cs
- RuntimeConfigLKG.cs
- DataGridComponentEditor.cs
- WindowClosedEventArgs.cs
- NamespaceQuery.cs
- DataViewSetting.cs
- ProtocolsConfiguration.cs
- XmlIlGenerator.cs
- StringBuilder.cs
- AssemblyName.cs
- TimeoutValidationAttribute.cs
- ColorTransform.cs
- XmlDataSource.cs
- OverflowException.cs
- SignatureHelper.cs
- MachinePropertyVariants.cs
- AliasGenerator.cs
- wgx_sdk_version.cs
- RemoteWebConfigurationHost.cs
- AutomationProperties.cs
- Atom10FormatterFactory.cs
- ProjectionCamera.cs
- VisualProxy.cs
- SetStateDesigner.cs
- ItemChangedEventArgs.cs
- OperationAbortedException.cs
- CalendarButtonAutomationPeer.cs
- DetailsViewUpdateEventArgs.cs
- RepeatButton.cs
- ScopelessEnumAttribute.cs
- basenumberconverter.cs
- DesignerSerializerAttribute.cs
- AddInContractAttribute.cs
- DBConnectionString.cs
- SqlProfileProvider.cs
- ColumnPropertiesGroup.cs
- Pair.cs
- IdnElement.cs
- SkewTransform.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- WorkItem.cs
- TileBrush.cs
- InlineCollection.cs
- AddInBase.cs
- FontEmbeddingManager.cs
- KerberosSecurityTokenProvider.cs
- MetadataItem_Static.cs
- EntityStoreSchemaGenerator.cs
- CancelEventArgs.cs
- HtmlHead.cs
- CfgParser.cs
- ProfilePropertySettings.cs
- DataProtection.cs
- StringReader.cs
- DesignSurfaceEvent.cs
- xmlsaver.cs
- Int16AnimationBase.cs
- DataGrid.cs
- HtmlMeta.cs
- XmlDictionaryReaderQuotas.cs
- SecurityTokenRequirement.cs
- DictionarySectionHandler.cs
- StandardCommands.cs
- GridSplitterAutomationPeer.cs
- TextBounds.cs
- PathFigureCollection.cs
- Image.cs
- MonthCalendar.cs
- MLangCodePageEncoding.cs
- CodeSnippetCompileUnit.cs
- DependencyObjectProvider.cs
- ThrowOnMultipleAssignment.cs
- SizeValueSerializer.cs
- AppDomainFactory.cs
- ScalarConstant.cs
- PermissionSetEnumerator.cs
- UrlMapping.cs
- BitmapImage.cs
- ConnectionProviderAttribute.cs
- BamlRecords.cs
- PrintPreviewControl.cs
- Bold.cs
- LineMetrics.cs
- XPathNodeList.cs
- UntrustedRecipientException.cs
- CallbackValidatorAttribute.cs
- UiaCoreProviderApi.cs
- CoTaskMemHandle.cs
- Misc.cs
- CustomAttribute.cs
- AtomEntry.cs
- WmfPlaceableFileHeader.cs
- LicenseException.cs
- TableLayoutPanelCellPosition.cs
- TypeDescriptionProvider.cs
- DataGridViewComboBoxEditingControl.cs
- AvTraceFormat.cs
- SqlMethodTransformer.cs
- TdsEnums.cs
- Descriptor.cs