Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AbandonedMutexException.cs
- _BasicClient.cs
- MobileControlsSection.cs
- ClipboardData.cs
- ControlValuePropertyAttribute.cs
- EventWaitHandle.cs
- ApplicationException.cs
- LinqDataSourceHelper.cs
- WebPartsPersonalizationAuthorization.cs
- ThumbAutomationPeer.cs
- AuthorizationRule.cs
- XPathNavigatorKeyComparer.cs
- Journaling.cs
- TypeSystem.cs
- FaultContractInfo.cs
- BlurBitmapEffect.cs
- OuterGlowBitmapEffect.cs
- TraceUtility.cs
- DNS.cs
- DataGridViewSortCompareEventArgs.cs
- StyleCollection.cs
- ToolBarOverflowPanel.cs
- EntityContainerRelationshipSet.cs
- SkinBuilder.cs
- FeatureSupport.cs
- ParameterToken.cs
- DataExpression.cs
- PointLightBase.cs
- PnrpPeerResolverElement.cs
- RNGCryptoServiceProvider.cs
- PasswordDeriveBytes.cs
- oledbconnectionstring.cs
- Zone.cs
- ArraySortHelper.cs
- DockPatternIdentifiers.cs
- IntegerFacetDescriptionElement.cs
- ProvidePropertyAttribute.cs
- unsafeIndexingFilterStream.cs
- XmlRawWriterWrapper.cs
- SafeIUnknown.cs
- AttributeQuery.cs
- StoreItemCollection.Loader.cs
- ClrProviderManifest.cs
- SQLDecimal.cs
- ExtendedProperty.cs
- UDPClient.cs
- XmlSchemaAppInfo.cs
- ProfileParameter.cs
- XmlSchemaComplexType.cs
- OleDbException.cs
- PropertyItemInternal.cs
- MetaModel.cs
- FixedHyperLink.cs
- UrlPath.cs
- _NestedSingleAsyncResult.cs
- __FastResourceComparer.cs
- RegexRunnerFactory.cs
- Int64KeyFrameCollection.cs
- WriteableBitmap.cs
- ManifestResourceInfo.cs
- CharEntityEncoderFallback.cs
- WebPartDisplayModeEventArgs.cs
- DataGridViewColumnConverter.cs
- ObjectCloneHelper.cs
- ResXDataNode.cs
- StrokeSerializer.cs
- ManagementObjectSearcher.cs
- ForceCopyBuildProvider.cs
- DbTransaction.cs
- WindowsGrip.cs
- EntityDataSourceDataSelection.cs
- ValidateNames.cs
- ListItemCollection.cs
- future.cs
- RequestQueue.cs
- Size.cs
- TraceSection.cs
- PlainXmlWriter.cs
- EventRouteFactory.cs
- SelectionHighlightInfo.cs
- MarginsConverter.cs
- HostingPreferredMapPath.cs
- Intellisense.cs
- ToolBarButton.cs
- querybuilder.cs
- FlowNode.cs
- PolyQuadraticBezierSegment.cs
- PageBuildProvider.cs
- CommandTreeTypeHelper.cs
- Rect3D.cs
- MessagePropertyFilter.cs
- ConfigXmlAttribute.cs
- DataGridColumnFloatingHeader.cs
- PackagePartCollection.cs
- BamlTreeNode.cs
- PreservationFileReader.cs
- BoundColumn.cs
- IndexedString.cs
- DataServiceProviderMethods.cs
- HtmlToClrEventProxy.cs