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
- UrlParameterReader.cs
- PackageDigitalSignatureManager.cs
- VisualBrush.cs
- AspNetHostingPermission.cs
- XmlIgnoreAttribute.cs
- List.cs
- DataGridDesigner.cs
- Screen.cs
- ActivityDesigner.cs
- BlurEffect.cs
- BitmapMetadataEnumerator.cs
- Currency.cs
- BindingListCollectionView.cs
- ToolStripLocationCancelEventArgs.cs
- HttpModulesSection.cs
- MonthCalendar.cs
- EntitySetBaseCollection.cs
- ScrollBar.cs
- TextParagraphCache.cs
- MessagePropertyAttribute.cs
- XPathParser.cs
- PerformanceCounterManager.cs
- AttributeUsageAttribute.cs
- AutoGeneratedFieldProperties.cs
- WebConfigurationManager.cs
- OutOfProcStateClientManager.cs
- ReturnType.cs
- WrapPanel.cs
- PeerObject.cs
- WebPartUtil.cs
- OdbcDataReader.cs
- DataObjectCopyingEventArgs.cs
- FontUnit.cs
- XslTransformFileEditor.cs
- JsonSerializer.cs
- CryptographicAttribute.cs
- ToolStripContentPanelRenderEventArgs.cs
- DoubleKeyFrameCollection.cs
- ReadContentAsBinaryHelper.cs
- ItemContainerGenerator.cs
- mediaeventshelper.cs
- ProcessInfo.cs
- EventProvider.cs
- XmlWriter.cs
- PathBox.cs
- ToolStripRenderEventArgs.cs
- PingReply.cs
- HitTestFilterBehavior.cs
- TextDocumentView.cs
- ConfigXmlText.cs
- TraceLevelStore.cs
- Material.cs
- COM2FontConverter.cs
- FixedSOMTable.cs
- XmlIterators.cs
- WebPartConnectionsCloseVerb.cs
- SqlDependencyListener.cs
- DesignerProperties.cs
- SqlUserDefinedTypeAttribute.cs
- DistributedTransactionPermission.cs
- Perspective.cs
- ResumeStoryboard.cs
- RolePrincipal.cs
- TextRangeBase.cs
- TrackingMemoryStreamFactory.cs
- UiaCoreApi.cs
- ToolStripScrollButton.cs
- SqlGatherConsumedAliases.cs
- PageCatalogPart.cs
- RegexFCD.cs
- WebPartCloseVerb.cs
- LinqDataView.cs
- ReflectPropertyDescriptor.cs
- TextMetrics.cs
- EventLog.cs
- TreeNodeBinding.cs
- CollectionViewSource.cs
- ImpersonationContext.cs
- SQLString.cs
- SafeLibraryHandle.cs
- QuaternionRotation3D.cs
- BrowserCapabilitiesFactory.cs
- CodeLinePragma.cs
- CodeGeneratorAttribute.cs
- OptimizedTemplateContent.cs
- ShaperBuffers.cs
- ExpandSegment.cs
- SoapTypeAttribute.cs
- RenderData.cs
- SynchronizationScope.cs
- SchemaImporter.cs
- BindingExpressionBase.cs
- System.Data_BID.cs
- AsyncStreamReader.cs
- MemberProjectedSlot.cs
- XmlAggregates.cs
- CapacityStreamGeometryContext.cs
- namescope.cs
- MemoryRecordBuffer.cs
- SubMenuStyle.cs