Code:
/ FX-1434 / FX-1434 / 1.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
- TextEffect.cs
- PresentationTraceSources.cs
- Scene3D.cs
- DataGridDetailsPresenter.cs
- AssociationEndMember.cs
- HtmlTableCellCollection.cs
- SystemIcons.cs
- SqlFacetAttribute.cs
- URLIdentityPermission.cs
- CatalogZoneBase.cs
- xdrvalidator.cs
- TeredoHelper.cs
- EllipseGeometry.cs
- ValidationManager.cs
- SystemIPGlobalProperties.cs
- NetworkAddressChange.cs
- WebPartEditorApplyVerb.cs
- Mapping.cs
- RIPEMD160Managed.cs
- EmptyWithCancelationCheckWorkItem.cs
- TransportContext.cs
- OdbcCommandBuilder.cs
- ConfigXmlWhitespace.cs
- _NetworkingPerfCounters.cs
- ToolStripSeparatorRenderEventArgs.cs
- HashCodeCombiner.cs
- Matrix3DConverter.cs
- DefaultEventAttribute.cs
- ResourceReferenceExpressionConverter.cs
- SafeNativeMethods.cs
- KeyInterop.cs
- Boolean.cs
- XmlNodeReader.cs
- TrackingWorkflowEventArgs.cs
- DataServiceHost.cs
- CodeCatchClauseCollection.cs
- GlyphRunDrawing.cs
- DefaultHttpHandler.cs
- WebServiceData.cs
- TraceUtility.cs
- DataBinder.cs
- CompositeDesignerAccessibleObject.cs
- SAPIEngineTypes.cs
- DecimalAnimationUsingKeyFrames.cs
- EncoderParameter.cs
- DSGeneratorProblem.cs
- SynchronizedDispatch.cs
- LinkClickEvent.cs
- SystemIPv4InterfaceProperties.cs
- PropertyRecord.cs
- FacetEnabledSchemaElement.cs
- ValueTypeFixupInfo.cs
- DiagnosticsConfigurationHandler.cs
- XmlReaderSettings.cs
- ConstraintCollection.cs
- ReadingWritingEntityEventArgs.cs
- SettingsProperty.cs
- CodeDirectionExpression.cs
- ScriptControlDescriptor.cs
- MailSettingsSection.cs
- WizardSideBarListControlItem.cs
- XmlSchemaSearchPattern.cs
- FileRecordSequenceCompletedAsyncResult.cs
- ControlPager.cs
- SafeIUnknown.cs
- Style.cs
- DataTemplateKey.cs
- XPathDocumentIterator.cs
- GraphicsPathIterator.cs
- LogLogRecord.cs
- NumberFormatInfo.cs
- PackageRelationship.cs
- DataSourceView.cs
- HtmlUtf8RawTextWriter.cs
- MarshalByRefObject.cs
- GridViewCellAutomationPeer.cs
- CqlGenerator.cs
- RegisteredExpandoAttribute.cs
- CustomErrorCollection.cs
- MissingSatelliteAssemblyException.cs
- HostExecutionContextManager.cs
- ComplexObject.cs
- XmlSchemaElement.cs
- Transform.cs
- SQLBoolean.cs
- TreeViewImageKeyConverter.cs
- SqlConnectionManager.cs
- CreateUserErrorEventArgs.cs
- AttachedPropertyBrowsableAttribute.cs
- FontFamily.cs
- UnknownBitmapDecoder.cs
- OracleDateTime.cs
- SoapFault.cs
- ContentElement.cs
- MgmtConfigurationRecord.cs
- DecoderBestFitFallback.cs
- UIAgentMonitor.cs
- EndpointDiscoveryMetadata.cs
- COM2Enum.cs
- IntegerValidator.cs