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
- _PooledStream.cs
- PersianCalendar.cs
- FamilyTypeface.cs
- DetailsViewInsertEventArgs.cs
- StopStoryboard.cs
- ProjectionPruner.cs
- SafeNativeMethodsOther.cs
- StrongNameUtility.cs
- PointCollection.cs
- SettingsSavedEventArgs.cs
- PartialTrustHelpers.cs
- BindingOperations.cs
- ExpressionEditorAttribute.cs
- AxisAngleRotation3D.cs
- ControlEvent.cs
- MarkupExtensionReturnTypeAttribute.cs
- Scripts.cs
- ShapeTypeface.cs
- MDIControlStrip.cs
- TextSelectionProcessor.cs
- WinFormsComponentEditor.cs
- ShapingWorkspace.cs
- columnmapkeybuilder.cs
- DataSourceXmlSubItemAttribute.cs
- HttpPostedFile.cs
- RangeBase.cs
- Lazy.cs
- CounterSample.cs
- HttpResponseWrapper.cs
- propertytag.cs
- WebFaultClientMessageInspector.cs
- ArithmeticException.cs
- DisplayMemberTemplateSelector.cs
- DBCommandBuilder.cs
- MasterPageBuildProvider.cs
- Helper.cs
- ReturnValue.cs
- GlyphingCache.cs
- SystemIPInterfaceProperties.cs
- WebPartTransformerAttribute.cs
- TemplatedWizardStep.cs
- Html32TextWriter.cs
- NotifyIcon.cs
- NativeCppClassAttribute.cs
- AnnotationAuthorChangedEventArgs.cs
- MutexSecurity.cs
- TreeBuilderXamlTranslator.cs
- RenameRuleObjectDialog.Designer.cs
- contentDescriptor.cs
- GuidelineCollection.cs
- WebPartConnectionsCloseVerb.cs
- Substitution.cs
- TypeToken.cs
- FlowNode.cs
- SettingsPropertyWrongTypeException.cs
- DeviceContext2.cs
- FixUp.cs
- RijndaelManagedTransform.cs
- BypassElementCollection.cs
- XmlAtomicValue.cs
- ConfigurationManagerInternal.cs
- PixelShader.cs
- SecurityKeyUsage.cs
- XmlLoader.cs
- DynamicFilterExpression.cs
- Pen.cs
- HttpWriter.cs
- SkewTransform.cs
- newitemfactory.cs
- Int64Converter.cs
- ViewPort3D.cs
- WebBrowserDesigner.cs
- WebPartHelpVerb.cs
- UnsafeMethods.cs
- LinqDataSourceDeleteEventArgs.cs
- xsdvalidator.cs
- ListBindingHelper.cs
- CngKeyBlobFormat.cs
- Exception.cs
- PropertyGeneratedEventArgs.cs
- AppDomainAttributes.cs
- KnownTypeAttribute.cs
- CollectionViewGroupRoot.cs
- HttpDictionary.cs
- versioninfo.cs
- DrawingImage.cs
- DLinqAssociationProvider.cs
- ActivitySurrogateSelector.cs
- ChtmlPageAdapter.cs
- CustomErrorCollection.cs
- Matrix.cs
- InternalConfigHost.cs
- PinnedBufferMemoryStream.cs
- OdbcStatementHandle.cs
- InternalConfigSettingsFactory.cs
- PersonalizationProviderHelper.cs
- SystemWebCachingSectionGroup.cs
- ObjectDataSourceEventArgs.cs
- DocumentPageView.cs
- TakeQueryOptionExpression.cs