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
- XmlSerializationGeneratedCode.cs
- MenuItemCollection.cs
- _NegotiateClient.cs
- SequenceFullException.cs
- Quaternion.cs
- IntSecurity.cs
- AccessorTable.cs
- PerspectiveCamera.cs
- ActivityWithResultWrapper.cs
- AppSecurityManager.cs
- ExtendedProtectionPolicyTypeConverter.cs
- RotateTransform.cs
- CachingHintValidation.cs
- BuildProviderUtils.cs
- LZCodec.cs
- Token.cs
- VisualStyleRenderer.cs
- x509store.cs
- OneWayBindingElement.cs
- AssemblyBuilder.cs
- odbcmetadatacollectionnames.cs
- EntityType.cs
- MenuItemBinding.cs
- SQLDecimalStorage.cs
- XmlCompatibilityReader.cs
- NullRuntimeConfig.cs
- ToolTipService.cs
- HelpProvider.cs
- CmsInterop.cs
- bidPrivateBase.cs
- ComplexPropertyEntry.cs
- ItemAutomationPeer.cs
- NonParentingControl.cs
- BinaryObjectInfo.cs
- TrackBar.cs
- RoutedEventArgs.cs
- XmlIncludeAttribute.cs
- CapiSafeHandles.cs
- StringFormat.cs
- QilInvokeLateBound.cs
- RootProfilePropertySettingsCollection.cs
- EncoderNLS.cs
- webbrowsersite.cs
- RequestCacheValidator.cs
- ComplexTypeEmitter.cs
- PagesSection.cs
- ProfileBuildProvider.cs
- FactoryGenerator.cs
- GeneralTransform3DTo2DTo3D.cs
- IssuedTokenClientCredential.cs
- EventPropertyMap.cs
- PerformanceCounterPermissionEntry.cs
- UnsafeNativeMethods.cs
- SqlDataSourceCommandEventArgs.cs
- AudioSignalProblemOccurredEventArgs.cs
- WeakReferenceList.cs
- PerformanceCounterPermissionAttribute.cs
- TimelineCollection.cs
- SwitchLevelAttribute.cs
- XsltConvert.cs
- DoubleKeyFrameCollection.cs
- ServiceDescriptionData.cs
- TableStyle.cs
- basecomparevalidator.cs
- DataKey.cs
- FileUpload.cs
- Journaling.cs
- QueryOutputWriter.cs
- CalendarAutoFormat.cs
- BackgroundWorker.cs
- FontCollection.cs
- EffectiveValueEntry.cs
- BinHexDecoder.cs
- ViewLoader.cs
- Classification.cs
- TextRangeEdit.cs
- SettingsPropertyCollection.cs
- JournalEntryStack.cs
- CodeCompileUnit.cs
- ReliableMessagingVersionConverter.cs
- ProxyFragment.cs
- BinarySerializer.cs
- EntityProviderServices.cs
- SoapElementAttribute.cs
- BindingMemberInfo.cs
- CodeParameterDeclarationExpression.cs
- CallContext.cs
- SqlDataSourceParameterParser.cs
- ObjectContextServiceProvider.cs
- BaseAppDomainProtocolHandler.cs
- HttpRuntime.cs
- RoleManagerEventArgs.cs
- RecognizeCompletedEventArgs.cs
- SystemGatewayIPAddressInformation.cs
- DbRetry.cs
- WorkflowInstance.cs
- MsmqInputChannel.cs
- _emptywebproxy.cs
- TextComposition.cs
- StringFreezingAttribute.cs