Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Collections / CaseInsensitiveHashCodeProvider.cs / 1305376 / 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; using System.Diagnostics.Contracts; [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"); } Contract.EndContractBlock(); m_text = culture.TextInfo; } public static CaseInsensitiveHashCodeProvider Default { get { Contract.Ensures(Contract.Result() != null); return new CaseInsensitiveHashCodeProvider(CultureInfo.CurrentCulture); } } public static CaseInsensitiveHashCodeProvider DefaultInvariant { get { Contract.Ensures(Contract.Result () != null); 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"); } Contract.EndContractBlock(); 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
- ParameterReplacerVisitor.cs
- WindowsFont.cs
- WebPartDeleteVerb.cs
- ListComponentEditorPage.cs
- EventPrivateKey.cs
- WindowsFormsHelpers.cs
- AddInEnvironment.cs
- EventHandlerList.cs
- GlyphingCache.cs
- MissingFieldException.cs
- CopyAttributesAction.cs
- TemplateBuilder.cs
- SelectionPattern.cs
- Schema.cs
- MenuAutoFormat.cs
- FilteredSchemaElementLookUpTable.cs
- RowType.cs
- TokenDescriptor.cs
- AssemblyBuilder.cs
- BitmapDecoder.cs
- TextDocumentView.cs
- DataList.cs
- ClientSideProviderDescription.cs
- LinearGradientBrush.cs
- HtmlTableCell.cs
- DesigntimeLicenseContext.cs
- CompModSwitches.cs
- Mapping.cs
- RectangleHotSpot.cs
- LinqDataView.cs
- CharAnimationBase.cs
- ArraySegment.cs
- DriveNotFoundException.cs
- Bezier.cs
- ScalarType.cs
- SelectionListDesigner.cs
- TemplateNameScope.cs
- BaseUriHelper.cs
- PropertyPathWorker.cs
- PageSettings.cs
- EncryptedKeyIdentifierClause.cs
- FrameDimension.cs
- WebBrowserNavigatedEventHandler.cs
- Label.cs
- _AutoWebProxyScriptEngine.cs
- SafeViewOfFileHandle.cs
- IndentedWriter.cs
- SafeReadContext.cs
- DictionaryTraceRecord.cs
- Padding.cs
- SecurityContextSecurityTokenAuthenticator.cs
- XamlInt32CollectionSerializer.cs
- CompilationSection.cs
- ListBindingHelper.cs
- ExchangeUtilities.cs
- Formatter.cs
- BaseDataBoundControlDesigner.cs
- DataObjectEventArgs.cs
- DataViewListener.cs
- AllMembershipCondition.cs
- ActionFrame.cs
- _HelperAsyncResults.cs
- CompositeDataBoundControl.cs
- SymmetricKeyWrap.cs
- XPathException.cs
- SpeechRecognizer.cs
- DesignTimeVisibleAttribute.cs
- SmtpDigestAuthenticationModule.cs
- StateItem.cs
- SpellerError.cs
- MarkupObject.cs
- ConfigXmlComment.cs
- DrawingAttributeSerializer.cs
- NavigationProperty.cs
- RepeatBehavior.cs
- DisplayInformation.cs
- StreamUpgradeInitiator.cs
- IgnoreSection.cs
- TypeLoadException.cs
- HostExecutionContextManager.cs
- NotImplementedException.cs
- ICspAsymmetricAlgorithm.cs
- ComponentSerializationService.cs
- ImmutableClientRuntime.cs
- CodeNamespaceCollection.cs
- ExplicitDiscriminatorMap.cs
- RemotingHelper.cs
- RootBuilder.cs
- DbProviderSpecificTypePropertyAttribute.cs
- CharStorage.cs
- HttpFileCollectionWrapper.cs
- ProxyHwnd.cs
- TextRangeProviderWrapper.cs
- HealthMonitoringSection.cs
- login.cs
- SecurityTokenAuthenticator.cs
- BamlRecordReader.cs
- WinInet.cs
- TrackingServices.cs
- CqlErrorHelper.cs