Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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); } } } // 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; [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); } } } // 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
- CharacterBufferReference.cs
- DesignerTransaction.cs
- ClientTargetCollection.cs
- XmlReaderDelegator.cs
- EastAsianLunisolarCalendar.cs
- PropertyEmitterBase.cs
- NamespaceExpr.cs
- Debug.cs
- SponsorHelper.cs
- ProxySimple.cs
- ParentQuery.cs
- KeyInterop.cs
- ClientUtils.cs
- SByteStorage.cs
- XsdBuilder.cs
- SecurityHeaderElementInferenceEngine.cs
- SelectionHighlightInfo.cs
- NotSupportedException.cs
- SchemaImporter.cs
- DataGridViewRowPostPaintEventArgs.cs
- XmlSchemaSequence.cs
- TargetInvocationException.cs
- EventLog.cs
- EntryWrittenEventArgs.cs
- TextModifier.cs
- TcpConnectionPool.cs
- AutomationElementIdentifiers.cs
- SQLBytes.cs
- ConstraintManager.cs
- compensatingcollection.cs
- DLinqTableProvider.cs
- StyleCollectionEditor.cs
- MappingItemCollection.cs
- TextPointerBase.cs
- StringUtil.cs
- BaseDataList.cs
- RuleConditionDialog.Designer.cs
- AutomationElementIdentifiers.cs
- ToolStripRendererSwitcher.cs
- InheritanceContextChangedEventManager.cs
- GCHandleCookieTable.cs
- QilBinary.cs
- HelpExampleGenerator.cs
- CodeChecksumPragma.cs
- ItemsControlAutomationPeer.cs
- KeyValuePair.cs
- GridErrorDlg.cs
- Misc.cs
- PropertyChangedEventArgs.cs
- HostProtectionException.cs
- TimerElapsedEvenArgs.cs
- PermissionSetEnumerator.cs
- FontUnitConverter.cs
- _SpnDictionary.cs
- _CommandStream.cs
- OpenFileDialog.cs
- AsyncContentLoadedEventArgs.cs
- RTLAwareMessageBox.cs
- WindowClosedEventArgs.cs
- ComboBoxItem.cs
- MouseActionValueSerializer.cs
- XmlSerializerAssemblyAttribute.cs
- BinaryReader.cs
- ToolStripRenderEventArgs.cs
- ValidationErrorCollection.cs
- EncryptedData.cs
- ClientCultureInfo.cs
- DocumentScope.cs
- XmlIgnoreAttribute.cs
- EmptyStringExpandableObjectConverter.cs
- DataGridViewCellLinkedList.cs
- DataGridItem.cs
- HitTestResult.cs
- DecoderReplacementFallback.cs
- ConfigurationSectionCollection.cs
- TreeNodeCollection.cs
- DeferredTextReference.cs
- InitiatorSessionSymmetricMessageSecurityProtocol.cs
- ScrollChrome.cs
- BigInt.cs
- DateTimeStorage.cs
- validation.cs
- Action.cs
- CodeArgumentReferenceExpression.cs
- Transform.cs
- LocationSectionRecord.cs
- LogWriteRestartAreaAsyncResult.cs
- Helper.cs
- TableItemPattern.cs
- DiscoveryServerProtocol.cs
- Converter.cs
- ConfigurationStrings.cs
- Thread.cs
- DataServiceResponse.cs
- PageStatePersister.cs
- RemotingSurrogateSelector.cs
- LogStream.cs
- VersionedStreamOwner.cs
- SmiConnection.cs
- TrackingStringDictionary.cs