Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Collections / CaseInsensitiveHashCodeProvider.cs / 1305376 / 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; using System.Diagnostics.Contracts; [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"); } Contract.EndContractBlock(); m_text = culture.TextInfo; } public static CaseInsensitiveHashCodeProvider Default { get { Contract.Ensures(Contract.Result() != null); return new CaseInsensitiveHashCodeProvider(CultureInfo.CurrentCulture); } } public static CaseInsensitiveHashCodeProvider DefaultInvariant { get { Contract.Ensures(Contract.Result () != null); 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"); } Contract.EndContractBlock(); 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; using System.Diagnostics.Contracts; [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"); } Contract.EndContractBlock(); m_text = culture.TextInfo; } public static CaseInsensitiveHashCodeProvider Default { get { Contract.Ensures(Contract.Result() != null); return new CaseInsensitiveHashCodeProvider(CultureInfo.CurrentCulture); } } public static CaseInsensitiveHashCodeProvider DefaultInvariant { get { Contract.Ensures(Contract.Result () != null); 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"); } Contract.EndContractBlock(); 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
- AdCreatedEventArgs.cs
- TreeIterator.cs
- PermissionToken.cs
- RewritingValidator.cs
- SoapWriter.cs
- SqlRewriteScalarSubqueries.cs
- BindingList.cs
- CodeConditionStatement.cs
- ToolboxItemLoader.cs
- Camera.cs
- ActionFrame.cs
- Line.cs
- ListControlDataBindingHandler.cs
- SpeakCompletedEventArgs.cs
- EntryWrittenEventArgs.cs
- RadioButtonStandardAdapter.cs
- DataControlButton.cs
- ResolveDuplexAsyncResult.cs
- FontDialog.cs
- XamlRtfConverter.cs
- FileIOPermission.cs
- EventListener.cs
- RegexStringValidatorAttribute.cs
- Rect3DValueSerializer.cs
- BinaryObjectInfo.cs
- SslStreamSecurityUpgradeProvider.cs
- DoubleLink.cs
- AutomationProperty.cs
- PenThreadPool.cs
- CssStyleCollection.cs
- SqlUtil.cs
- WebContext.cs
- MetadataArtifactLoaderCompositeResource.cs
- AndAlso.cs
- ManagedFilter.cs
- XmlValidatingReaderImpl.cs
- CodeCompileUnit.cs
- XmlStringTable.cs
- CookieParameter.cs
- SessionStateModule.cs
- Effect.cs
- AppDomain.cs
- RegexWriter.cs
- HighlightComponent.cs
- CodeDirectionExpression.cs
- HttpClientCertificate.cs
- IconConverter.cs
- EncodingInfo.cs
- FormViewAutoFormat.cs
- ManagementOptions.cs
- CultureTableRecord.cs
- XmlCodeExporter.cs
- HostedAspNetEnvironment.cs
- Win32SafeHandles.cs
- ToolstripProfessionalRenderer.cs
- BinaryWriter.cs
- ZipFileInfoCollection.cs
- SimpleHandlerFactory.cs
- RowSpanVector.cs
- BulletChrome.cs
- ProvidersHelper.cs
- DbConnectionHelper.cs
- GroupBox.cs
- ApplicationServiceManager.cs
- MimeTypeAttribute.cs
- CompositeControl.cs
- RSAOAEPKeyExchangeDeformatter.cs
- ConsoleTraceListener.cs
- Directory.cs
- PrivilegedConfigurationManager.cs
- SR.cs
- DrawingGroup.cs
- ResumeStoryboard.cs
- ConversionHelper.cs
- PartBasedPackageProperties.cs
- IdentityManager.cs
- OdbcConnectionPoolProviderInfo.cs
- DbConnectionPoolCounters.cs
- FileReader.cs
- UnmanagedMemoryStreamWrapper.cs
- CodeDirectoryCompiler.cs
- ErrorsHelper.cs
- clipboard.cs
- _HelperAsyncResults.cs
- ContentFileHelper.cs
- DataGridViewCellStyleConverter.cs
- EntityDataSourceView.cs
- Switch.cs
- XmlCountingReader.cs
- StringSorter.cs
- cache.cs
- HwndHostAutomationPeer.cs
- TableRowGroup.cs
- Fonts.cs
- RichTextBox.cs
- Bitmap.cs
- unsafenativemethodsother.cs
- Point4DConverter.cs
- DataGridTablesFactory.cs
- CompatibleComparer.cs