Code:
/ DotNET / DotNET / 8.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
- NullableDoubleMinMaxAggregationOperator.cs
- NotImplementedException.cs
- ColorConverter.cs
- HtmlTextViewAdapter.cs
- Model3DGroup.cs
- TextContainerChangedEventArgs.cs
- MruCache.cs
- xml.cs
- XPathMessageFilterElement.cs
- Line.cs
- ProtocolViolationException.cs
- WebPartDescription.cs
- Int64KeyFrameCollection.cs
- DesignerProperties.cs
- ExceptionHandlersDesigner.cs
- SystemIPInterfaceProperties.cs
- Conditional.cs
- MatrixTransform.cs
- FixedDocumentSequencePaginator.cs
- Intellisense.cs
- StrokeSerializer.cs
- ByteStreamGeometryContext.cs
- NullRuntimeConfig.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- TcpAppDomainProtocolHandler.cs
- FocusWithinProperty.cs
- RoutedEvent.cs
- PropertyManager.cs
- LocatorPartList.cs
- Baml2006SchemaContext.cs
- AmbientValueAttribute.cs
- TextParagraphView.cs
- ListViewInsertEventArgs.cs
- NonBatchDirectoryCompiler.cs
- GuidelineSet.cs
- GridViewUpdatedEventArgs.cs
- DataTableNewRowEvent.cs
- XmlSchemaSimpleTypeRestriction.cs
- DocumentCollection.cs
- OdbcConnectionString.cs
- ObjectItemConventionAssemblyLoader.cs
- RewritingSimplifier.cs
- SizeKeyFrameCollection.cs
- ConsumerConnectionPointCollection.cs
- WindowsEditBox.cs
- SqlMultiplexer.cs
- TeredoHelper.cs
- InvocationExpression.cs
- ImmutableObjectAttribute.cs
- XPathNodeHelper.cs
- ListBox.cs
- ProviderCommandInfoUtils.cs
- DataGridPagerStyle.cs
- PrintPageEvent.cs
- JsonUriDataContract.cs
- QilPatternVisitor.cs
- SimpleTypesSurrogate.cs
- StateFinalizationDesigner.cs
- BitVector32.cs
- IRCollection.cs
- AddressAccessDeniedException.cs
- HtmlSelectionListAdapter.cs
- FormView.cs
- ResourceCategoryAttribute.cs
- CheckableControlBaseAdapter.cs
- unsafenativemethodstextservices.cs
- DataGridViewRow.cs
- AVElementHelper.cs
- ConfigurationStrings.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- DbProviderFactories.cs
- OperatingSystem.cs
- PageHandlerFactory.cs
- XmlTypeAttribute.cs
- ConfigurationSchemaErrors.cs
- AuthenticationModulesSection.cs
- ReadOnlyNameValueCollection.cs
- TextBoxDesigner.cs
- DesignerHelpers.cs
- HttpCookiesSection.cs
- DataGridViewCellStyleEditor.cs
- X509SecurityTokenAuthenticator.cs
- FormattedTextSymbols.cs
- DataSourceDesigner.cs
- PeerNameRecordCollection.cs
- IsolatedStorageFilePermission.cs
- InputProcessorProfilesLoader.cs
- SemaphoreSecurity.cs
- URLMembershipCondition.cs
- XamlWriter.cs
- LineBreak.cs
- XmlNamespaceDeclarationsAttribute.cs
- StyleHelper.cs
- RequestResizeEvent.cs
- DecoderBestFitFallback.cs
- ProfileInfo.cs
- _ScatterGatherBuffers.cs
- DBBindings.cs
- PlainXmlSerializer.cs
- EntityConnectionStringBuilder.cs