Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Floater.cs
- XslCompiledTransform.cs
- LoginAutoFormat.cs
- GridErrorDlg.cs
- ManifestSignedXml.cs
- XhtmlConformanceSection.cs
- QuadraticBezierSegment.cs
- AlignmentXValidation.cs
- BaseParaClient.cs
- StylusPointPropertyUnit.cs
- MembershipPasswordException.cs
- DataGridViewImageColumn.cs
- WCFModelStrings.Designer.cs
- JpegBitmapDecoder.cs
- PhoneCallDesigner.cs
- EmptyEnumerator.cs
- UpdatePanelTrigger.cs
- RequestContext.cs
- RuntimeConfig.cs
- IntSecurity.cs
- TemplatePartAttribute.cs
- ProfileProvider.cs
- Configuration.cs
- HtmlInputButton.cs
- CharacterBuffer.cs
- UidPropertyAttribute.cs
- PerformanceCounterLib.cs
- ComPlusInstanceContextInitializer.cs
- XpsColorContext.cs
- XmlMembersMapping.cs
- Debug.cs
- RenderData.cs
- TextServicesHost.cs
- ParseHttpDate.cs
- PrintDocument.cs
- NetworkInformationException.cs
- WebServiceEnumData.cs
- SqlTransaction.cs
- PenContext.cs
- StrokeRenderer.cs
- RenderTargetBitmap.cs
- EntityStoreSchemaGenerator.cs
- ListDictionary.cs
- ExceptionUtil.cs
- LoopExpression.cs
- EntityModelBuildProvider.cs
- XmlSchemaSimpleType.cs
- RuntimeArgumentHandle.cs
- RequiredAttributeAttribute.cs
- PropertyMappingExceptionEventArgs.cs
- HtmlControlPersistable.cs
- ToolStripProgressBar.cs
- UpdateInfo.cs
- XPathBinder.cs
- KeyValueInternalCollection.cs
- LoggedException.cs
- XmlUrlEditor.cs
- ViewGenResults.cs
- SchemaTypeEmitter.cs
- ThumbAutomationPeer.cs
- IDQuery.cs
- WebPartTracker.cs
- DrawListViewSubItemEventArgs.cs
- ToolBarButtonClickEvent.cs
- TriState.cs
- WindowsRichEdit.cs
- WsdlParser.cs
- AutomationEvent.cs
- HyperLinkColumn.cs
- PostBackTrigger.cs
- WindowsGraphics2.cs
- MarkedHighlightComponent.cs
- DataGridViewCellPaintingEventArgs.cs
- InkSerializer.cs
- GlobalizationSection.cs
- SurrogateEncoder.cs
- InvokeBinder.cs
- GroupQuery.cs
- InstallerTypeAttribute.cs
- OutputCacheProfile.cs
- HttpRequestCacheValidator.cs
- SizeAnimationClockResource.cs
- WebPartUserCapability.cs
- ObfuscateAssemblyAttribute.cs
- MarkupObject.cs
- PenContexts.cs
- VarRemapper.cs
- FrameworkElement.cs
- Debug.cs
- ModelVisual3D.cs
- LinearKeyFrames.cs
- ProviderUtil.cs
- RichTextBoxConstants.cs
- XmlRawWriterWrapper.cs
- ListenerConnectionModeReader.cs
- RightsManagementManager.cs
- CollectionViewGroupInternal.cs
- DecimalKeyFrameCollection.cs
- NamespaceQuery.cs
- EntityConnection.cs