Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- BooleanFunctions.cs
- BroadcastEventHelper.cs
- LocatorPart.cs
- ToolStripItemRenderEventArgs.cs
- DbModificationCommandTree.cs
- XamlRtfConverter.cs
- Graph.cs
- ResourceIDHelper.cs
- ModuleBuilderData.cs
- AnchoredBlock.cs
- RegistryPermission.cs
- PolyLineSegment.cs
- UnaryNode.cs
- AffineTransform3D.cs
- ConnectionString.cs
- DiscoveryServerProtocol.cs
- TriState.cs
- FontUnitConverter.cs
- SqlCacheDependencySection.cs
- infer.cs
- TileBrush.cs
- WindowsStreamSecurityElement.cs
- ViewValidator.cs
- TemplateBindingExpression.cs
- IssuedTokenServiceElement.cs
- ArrayTypeMismatchException.cs
- XamlStream.cs
- MILUtilities.cs
- TextElement.cs
- GiveFeedbackEventArgs.cs
- Rules.cs
- InputReportEventArgs.cs
- FormatSettings.cs
- FrugalList.cs
- PrinterResolution.cs
- input.cs
- dsa.cs
- TraceHandlerErrorFormatter.cs
- TableItemProviderWrapper.cs
- ListViewItemSelectionChangedEvent.cs
- MoveSizeWinEventHandler.cs
- DragEventArgs.cs
- AsyncCompletedEventArgs.cs
- UnicastIPAddressInformationCollection.cs
- EmulateRecognizeCompletedEventArgs.cs
- TableLayoutPanelCellPosition.cs
- VectorAnimation.cs
- PerformanceCounter.cs
- TextEditorMouse.cs
- StartFileNameEditor.cs
- QuadTree.cs
- PreProcessor.cs
- TimeSpan.cs
- TransactionFlowBindingElementImporter.cs
- PeerIPHelper.cs
- MenuItemCollection.cs
- DesignerDataParameter.cs
- CrossSiteScriptingValidation.cs
- OdbcDataReader.cs
- GridViewRow.cs
- X500Name.cs
- RsaSecurityTokenParameters.cs
- BufferedReadStream.cs
- VisualBrush.cs
- GridViewCancelEditEventArgs.cs
- UniqueIdentifierService.cs
- TypeValidationEventArgs.cs
- Atom10FormatterFactory.cs
- FunctionGenerator.cs
- MarginsConverter.cs
- TextEffectResolver.cs
- MultilineStringConverter.cs
- CryptoKeySecurity.cs
- SendSecurityHeaderElementContainer.cs
- ObjectReaderCompiler.cs
- DocumentEventArgs.cs
- GeneratedCodeAttribute.cs
- DataTableMappingCollection.cs
- SignerInfo.cs
- SmtpSection.cs
- webeventbuffer.cs
- AsynchronousChannel.cs
- HScrollBar.cs
- CellQuery.cs
- messageonlyhwndwrapper.cs
- SqlProviderManifest.cs
- AsyncOperationManager.cs
- ControlBuilderAttribute.cs
- SubpageParaClient.cs
- TableAdapterManagerNameHandler.cs
- ComponentEditorForm.cs
- ConfigXmlComment.cs
- FilterQuery.cs
- ConfigXmlCDataSection.cs
- ContextStaticAttribute.cs
- DependencyPropertyDescriptor.cs
- ExceptionHandler.cs
- Mapping.cs
- SqlStream.cs
- CustomTypeDescriptor.cs