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
- CompilationPass2TaskInternal.cs
- BuildProviderAppliesToAttribute.cs
- NamespaceDisplayAutomationPeer.cs
- StaticResourceExtension.cs
- AdjustableArrowCap.cs
- MessageSecurityVersion.cs
- Effect.cs
- NullableDecimalSumAggregationOperator.cs
- ParallelSeparator.xaml.cs
- SqlBulkCopyColumnMappingCollection.cs
- XamlTreeBuilderBamlRecordWriter.cs
- SoapWriter.cs
- SafeNativeMethods.cs
- FixedBufferAttribute.cs
- GetFileNameResult.cs
- OleDbDataAdapter.cs
- BoundPropertyEntry.cs
- UnmanagedMemoryStream.cs
- MaxSessionCountExceededException.cs
- ShapeTypeface.cs
- PageSetupDialog.cs
- MemberMaps.cs
- Int32.cs
- VectorCollectionValueSerializer.cs
- _AuthenticationState.cs
- SqlUserDefinedTypeAttribute.cs
- XPathMultyIterator.cs
- MultiAsyncResult.cs
- VirtualizingPanel.cs
- ParallelRangeManager.cs
- TextEditorSelection.cs
- ButtonDesigner.cs
- DEREncoding.cs
- NCryptSafeHandles.cs
- SessionSymmetricMessageSecurityProtocolFactory.cs
- _ListenerRequestStream.cs
- DbExpressionRules.cs
- SessionStateContainer.cs
- ReturnValue.cs
- SimpleBitVector32.cs
- StylusPointPropertyUnit.cs
- XmlTypeMapping.cs
- AncillaryOps.cs
- ByteStreamGeometryContext.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- StringExpressionSet.cs
- FormView.cs
- CommonGetThemePartSize.cs
- NullableConverter.cs
- LinkedResourceCollection.cs
- OleDbConnectionInternal.cs
- keycontainerpermission.cs
- SchemaAttDef.cs
- XmlSchemaAnnotation.cs
- FrameworkTextComposition.cs
- SQLMoney.cs
- SharedUtils.cs
- Assembly.cs
- ResolvedKeyFrameEntry.cs
- WebPartCancelEventArgs.cs
- ForeignKeyConstraint.cs
- ParameterToken.cs
- RequestValidator.cs
- SQLRoleProvider.cs
- RegexCaptureCollection.cs
- ReadOnlyDictionary.cs
- DeadCharTextComposition.cs
- DataBindingCollection.cs
- XmlCodeExporter.cs
- WorkflowControlEndpoint.cs
- CircleHotSpot.cs
- FileUtil.cs
- DataGridViewCellMouseEventArgs.cs
- InstanceDescriptor.cs
- CustomCategoryAttribute.cs
- SystemColors.cs
- Helpers.cs
- GridSplitterAutomationPeer.cs
- AlignmentYValidation.cs
- PackWebRequestFactory.cs
- RadioButtonDesigner.cs
- SafeArrayTypeMismatchException.cs
- _DomainName.cs
- SqlDataReaderSmi.cs
- SoapCodeExporter.cs
- TraceHandlerErrorFormatter.cs
- XmlAttribute.cs
- RSAPKCS1KeyExchangeFormatter.cs
- WebControlParameterProxy.cs
- XmlNamespaceManager.cs
- WebReferencesBuildProvider.cs
- baseshape.cs
- OracleException.cs
- RotateTransform3D.cs
- FocusChangedEventArgs.cs
- MergeFilterQuery.cs
- Module.cs
- ToolStrip.cs
- StreamHelper.cs
- ReplyChannel.cs