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
- ErrorTableItemStyle.cs
- ActivityDefaults.cs
- TableItemPattern.cs
- DrawingContextWalker.cs
- XmlValidatingReader.cs
- Exceptions.cs
- AddingNewEventArgs.cs
- CodeArgumentReferenceExpression.cs
- XmlCDATASection.cs
- DirectoryInfo.cs
- TdsParserStateObject.cs
- ComplexLine.cs
- FixedDocument.cs
- DataErrorValidationRule.cs
- DelegateArgumentReference.cs
- RewritingProcessor.cs
- Monitor.cs
- Border.cs
- ReadOnlyDataSourceView.cs
- Run.cs
- Win32Exception.cs
- MonikerSyntaxException.cs
- DbProviderSpecificTypePropertyAttribute.cs
- Byte.cs
- FormViewUpdatedEventArgs.cs
- ValueType.cs
- Stopwatch.cs
- ParseNumbers.cs
- ComponentManagerBroker.cs
- BinarySerializer.cs
- HandledEventArgs.cs
- DeclarativeExpressionConditionDeclaration.cs
- DropSource.cs
- DesignTimeVisibleAttribute.cs
- AutomationIdentifierGuids.cs
- EncryptedKeyIdentifierClause.cs
- DoubleCollectionValueSerializer.cs
- TextEditorLists.cs
- DataGridViewCellStyle.cs
- XmlSchemaComplexContent.cs
- dataobject.cs
- PrinterSettings.cs
- NavigatorInput.cs
- DataRowChangeEvent.cs
- CommandManager.cs
- InlineUIContainer.cs
- WpfKnownType.cs
- ImageKeyConverter.cs
- HttpModule.cs
- odbcmetadatacollectionnames.cs
- PropertyDescriptorComparer.cs
- LineBreakRecord.cs
- UpdateExpressionVisitor.cs
- UniqueEventHelper.cs
- SimpleApplicationHost.cs
- CopyNamespacesAction.cs
- ReachVisualSerializer.cs
- X509Utils.cs
- GeneralTransform3D.cs
- TextPatternIdentifiers.cs
- CmsInterop.cs
- ManagementDateTime.cs
- TemplateComponentConnector.cs
- SecurityTokenParameters.cs
- KeyTimeConverter.cs
- TextViewSelectionProcessor.cs
- TrackingStringDictionary.cs
- SerialPinChanges.cs
- ContextBase.cs
- WebFaultException.cs
- Grid.cs
- BlobPersonalizationState.cs
- ScriptDescriptor.cs
- FeatureSupport.cs
- SqlDataSourceSelectingEventArgs.cs
- BuildProvider.cs
- JoinTreeSlot.cs
- FormCollection.cs
- Root.cs
- shaper.cs
- RepeatBehavior.cs
- Literal.cs
- Matrix.cs
- ObjectStateEntry.cs
- DataTableCollection.cs
- ContextMenu.cs
- FlowLayoutSettings.cs
- OracleParameter.cs
- DataGridItemCollection.cs
- SliderAutomationPeer.cs
- SchemaManager.cs
- DecoratedNameAttribute.cs
- PeerUnsafeNativeCryptMethods.cs
- EarlyBoundInfo.cs
- LineBreak.cs
- WorkerRequest.cs
- OdbcUtils.cs
- TextBox.cs
- MessageEventSubscriptionService.cs
- SizeAnimationUsingKeyFrames.cs