Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // 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); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ComEventsSink.cs
- QilFactory.cs
- ServiceProviders.cs
- DataGridViewCellEventArgs.cs
- SID.cs
- HitTestWithGeometryDrawingContextWalker.cs
- EntityTypeBase.cs
- SqlProfileProvider.cs
- SyndicationDeserializer.cs
- CustomAttribute.cs
- ScriptHandlerFactory.cs
- EventListenerClientSide.cs
- RubberbandSelector.cs
- StringArrayConverter.cs
- SqlGenericUtil.cs
- DeflateEmulationStream.cs
- MessageQueueException.cs
- X509CertificateChain.cs
- UnsafeNativeMethods.cs
- X509UI.cs
- ChangePassword.cs
- EventData.cs
- MaterialGroup.cs
- PlatformCulture.cs
- PrefixQName.cs
- RenamedEventArgs.cs
- Boolean.cs
- ProtectedConfiguration.cs
- XmlSchemaSimpleType.cs
- TaskHelper.cs
- WmfPlaceableFileHeader.cs
- ConfigXmlElement.cs
- NavigationService.cs
- Control.cs
- XmlConvert.cs
- SecurityState.cs
- IsolatedStorageFileStream.cs
- MenuAdapter.cs
- TextSelection.cs
- ADConnectionHelper.cs
- ItemChangedEventArgs.cs
- SimpleMailWebEventProvider.cs
- SecurityChannelFaultConverter.cs
- Evaluator.cs
- FloaterParaClient.cs
- DataObjectEventArgs.cs
- DispatcherFrame.cs
- DataServices.cs
- ClickablePoint.cs
- wgx_commands.cs
- Calendar.cs
- ValidationRule.cs
- FacetChecker.cs
- DownloadProgressEventArgs.cs
- HostProtectionException.cs
- Interlocked.cs
- MDIControlStrip.cs
- CLSCompliantAttribute.cs
- DnsPermission.cs
- TypedTableBaseExtensions.cs
- PersistenceTypeAttribute.cs
- Trigger.cs
- XmlSchemaValidator.cs
- MessagingDescriptionAttribute.cs
- DatePickerAutomationPeer.cs
- EventTrigger.cs
- TextTreeExtractElementUndoUnit.cs
- PolicyUnit.cs
- FormatConvertedBitmap.cs
- CodeDirectionExpression.cs
- Selection.cs
- SortExpressionBuilder.cs
- CounterCreationDataCollection.cs
- StylusOverProperty.cs
- PlatformNotSupportedException.cs
- RenamedEventArgs.cs
- EntityTypeEmitter.cs
- BamlResourceSerializer.cs
- SecureUICommand.cs
- TokenBasedSet.cs
- ObjectCacheSettings.cs
- WindowsProgressbar.cs
- BigInt.cs
- ChannelManagerHelpers.cs
- TdsParserStaticMethods.cs
- CompositeFontFamily.cs
- FileAuthorizationModule.cs
- X509CertificateCollection.cs
- ExpressionNode.cs
- VBIdentifierDesigner.xaml.cs
- ConvertersCollection.cs
- WindowsClaimSet.cs
- ItemCheckedEvent.cs
- ClientCultureInfo.cs
- ElementHostAutomationPeer.cs
- TemplateBindingExpressionConverter.cs
- Util.cs
- TextRunCacheImp.cs
- MasterPageBuildProvider.cs
- VerificationAttribute.cs