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
- Vector3dCollection.cs
- OdbcFactory.cs
- ApplicationSettingsBase.cs
- User.cs
- DependencyPropertyKey.cs
- JapaneseLunisolarCalendar.cs
- JoinSymbol.cs
- DoubleConverter.cs
- XNodeValidator.cs
- PrefixQName.cs
- XmlNamedNodeMap.cs
- PropertyValueUIItem.cs
- EntryPointNotFoundException.cs
- IPCCacheManager.cs
- FtpWebResponse.cs
- AgileSafeNativeMemoryHandle.cs
- ClassData.cs
- ContextMenu.cs
- Point.cs
- DatePickerTextBox.cs
- XmlTextReader.cs
- GestureRecognitionResult.cs
- MultipartContentParser.cs
- AnimationLayer.cs
- SubtreeProcessor.cs
- ControlIdConverter.cs
- AutomationElementCollection.cs
- RangeContentEnumerator.cs
- TypeElement.cs
- PropertyOverridesDialog.cs
- XmlEncodedRawTextWriter.cs
- ColorAnimationUsingKeyFrames.cs
- XPathScanner.cs
- GorillaCodec.cs
- CodeArgumentReferenceExpression.cs
- CodeAssignStatement.cs
- DocComment.cs
- BidOverLoads.cs
- ThreadTrace.cs
- SafeRightsManagementPubHandle.cs
- NetworkInformationException.cs
- TimeoutException.cs
- SQLDateTime.cs
- WebConfigurationManager.cs
- Variable.cs
- Grid.cs
- DurableInstanceProvider.cs
- InvalidCastException.cs
- CSharpCodeProvider.cs
- DbProviderServices.cs
- ActiveDocumentEvent.cs
- ZipIOLocalFileDataDescriptor.cs
- StreamAsIStream.cs
- SAPICategories.cs
- _LazyAsyncResult.cs
- XmlResolver.cs
- WebSysDescriptionAttribute.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- AssemblyUtil.cs
- WebEventTraceProvider.cs
- Form.cs
- DataSourceView.cs
- TripleDES.cs
- CodeGenHelper.cs
- ProcessManager.cs
- RegexStringValidator.cs
- ScriptModule.cs
- XmlDataSource.cs
- ZoneButton.cs
- Viewport3DVisual.cs
- HttpWebResponse.cs
- UnsignedPublishLicense.cs
- CqlIdentifiers.cs
- XmlCharCheckingWriter.cs
- RawStylusInputCustomDataList.cs
- ReflectionUtil.cs
- EntityClassGenerator.cs
- ScriptReference.cs
- AnchoredBlock.cs
- TagPrefixAttribute.cs
- ProtocolsSection.cs
- CompilationUnit.cs
- DataSourceViewSchemaConverter.cs
- XmlCustomFormatter.cs
- XmlComment.cs
- ContainerSelectorActiveEvent.cs
- XmlCustomFormatter.cs
- querybuilder.cs
- IdentityManager.cs
- UserValidatedEventArgs.cs
- UnsafeNativeMethodsCLR.cs
- RegexStringValidator.cs
- FamilyTypefaceCollection.cs
- TextDecorationUnitValidation.cs
- DataControlFieldCollection.cs
- WindowsStatic.cs
- TemplateXamlParser.cs
- ProxyHwnd.cs
- AppDomainProtocolHandler.cs
- DataGridViewRowPostPaintEventArgs.cs