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
- Win32PrintDialog.cs
- CompilationUtil.cs
- PropertyGrid.cs
- BinaryExpression.cs
- SystemResources.cs
- BamlResourceSerializer.cs
- MarkupExtensionReturnTypeAttribute.cs
- ListItemCollection.cs
- DynamicExpression.cs
- WindowsTitleBar.cs
- COM2PictureConverter.cs
- WindowsFormsHelpers.cs
- IERequestCache.cs
- GiveFeedbackEvent.cs
- WebConfigurationManager.cs
- JulianCalendar.cs
- AVElementHelper.cs
- __TransparentProxy.cs
- Message.cs
- ColumnProvider.cs
- OperationInfo.cs
- StylusCollection.cs
- TextEffectCollection.cs
- OdbcRowUpdatingEvent.cs
- FaultImportOptions.cs
- EmptyEnumerator.cs
- TimeZoneInfo.cs
- ProgressBarHighlightConverter.cs
- ListComponentEditor.cs
- ResourceDisplayNameAttribute.cs
- ToolStripPanelRenderEventArgs.cs
- ObjectDataSourceView.cs
- DocumentPage.cs
- StateDesigner.Helpers.cs
- ModifierKeysConverter.cs
- ColumnResizeAdorner.cs
- BookmarkTable.cs
- OracleDataReader.cs
- ParentUndoUnit.cs
- AmbientValueAttribute.cs
- RectAnimationClockResource.cs
- XmlValueConverter.cs
- TypedTableBase.cs
- AssociationSetMetadata.cs
- ManualResetEvent.cs
- RotateTransform3D.cs
- ResourcesBuildProvider.cs
- RowToFieldTransformer.cs
- RegexMatchCollection.cs
- HideDisabledControlAdapter.cs
- AbstractExpressions.cs
- BufferedStream.cs
- DecoderNLS.cs
- ObjectCloneHelper.cs
- PTUtility.cs
- SqlExpander.cs
- COM2IPerPropertyBrowsingHandler.cs
- PerformanceCounterLib.cs
- Win32SafeHandles.cs
- TerminateSequenceResponse.cs
- XmlUtf8RawTextWriter.cs
- QuadraticBezierSegment.cs
- BoundPropertyEntry.cs
- MenuItemBindingCollection.cs
- ParameterSubsegment.cs
- TextDecorationLocationValidation.cs
- TypeListConverter.cs
- PolicyStatement.cs
- BindingContext.cs
- FilterUserControlBase.cs
- Dump.cs
- TdsParserHelperClasses.cs
- SpecularMaterial.cs
- InsufficientMemoryException.cs
- QilUnary.cs
- CultureInfoConverter.cs
- HyperLinkField.cs
- RichTextBoxConstants.cs
- TdsEnums.cs
- AmbientLight.cs
- ProgressBar.cs
- Keywords.cs
- VirtualPathProvider.cs
- PenThreadPool.cs
- ToolStripContainer.cs
- VariableElement.cs
- StylusPointPropertyInfoDefaults.cs
- TypedReference.cs
- FixedFlowMap.cs
- LinqExpressionNormalizer.cs
- SubclassTypeValidator.cs
- Binding.cs
- ExponentialEase.cs
- DrawingState.cs
- EnglishPluralizationService.cs
- TreeNode.cs
- UpdateManifestForBrowserApplication.cs
- FlowLayoutPanel.cs
- XmlReturnReader.cs
- VSWCFServiceContractGenerator.cs