Code:
/ 4.0 / 4.0 / 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. // ==++== // // 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
- embossbitmapeffect.cs
- ScriptBehaviorDescriptor.cs
- CacheChildrenQuery.cs
- printdlgexmarshaler.cs
- ButtonColumn.cs
- ChtmlCalendarAdapter.cs
- WindowsAuthenticationModule.cs
- ArgumentValueSerializer.cs
- WindowsRebar.cs
- Win32PrintDialog.cs
- DefaultPrintController.cs
- EntityType.cs
- BitmapMetadataEnumerator.cs
- NativeMsmqMessage.cs
- InstanceDescriptor.cs
- DrawingContextWalker.cs
- SerializationFieldInfo.cs
- BaseProcessor.cs
- ScrollContentPresenter.cs
- InfoCardRSAPKCS1KeyExchangeFormatter.cs
- TreeView.cs
- DeclaredTypeElementCollection.cs
- brushes.cs
- InstancePersistenceException.cs
- MessageAction.cs
- InvalidWMPVersionException.cs
- DependencyProperty.cs
- LayoutTableCell.cs
- HelpHtmlBuilder.cs
- WebControlsSection.cs
- RuleSettings.cs
- SchemaDeclBase.cs
- ProtocolElementCollection.cs
- AnnotationStore.cs
- XPathNavigatorReader.cs
- FederatedMessageSecurityOverHttp.cs
- StoragePropertyMapping.cs
- TransformerInfo.cs
- TrustManagerPromptUI.cs
- UnsafeNativeMethods.cs
- TraceUtility.cs
- FixedTextPointer.cs
- StartFileNameEditor.cs
- FixedPage.cs
- SerialErrors.cs
- ExpressionUtilities.cs
- EncoderFallback.cs
- Border.cs
- DbConnectionFactory.cs
- WebDisplayNameAttribute.cs
- TextBoxView.cs
- ItemCollection.cs
- DataObjectAttribute.cs
- NavigatorInvalidBodyAccessException.cs
- XamlSerializer.cs
- HttpResponseHeader.cs
- CustomWebEventKey.cs
- EventProviderWriter.cs
- UidManager.cs
- RegexFCD.cs
- ProxyHelper.cs
- CompiledIdentityConstraint.cs
- SecondaryIndexList.cs
- ContentIterators.cs
- WebPartMovingEventArgs.cs
- EditorPartCollection.cs
- SqlHelper.cs
- DocumentXPathNavigator.cs
- RecipientInfo.cs
- ExitEventArgs.cs
- GlyphInfoList.cs
- BookmarkUndoUnit.cs
- SelectionRange.cs
- ValidationRule.cs
- safemediahandle.cs
- SchemaElementDecl.cs
- GroupJoinQueryOperator.cs
- BitmapEffectInputData.cs
- UriWriter.cs
- Accessible.cs
- DiscoveryMessageProperty.cs
- IPHostEntry.cs
- PreviewKeyDownEventArgs.cs
- ResourceReferenceKeyNotFoundException.cs
- XmlEventCache.cs
- AnimationException.cs
- DataSetMappper.cs
- ScalarConstant.cs
- GradientBrush.cs
- Panel.cs
- HashHelper.cs
- EntitySetDataBindingList.cs
- DocumentPage.cs
- MaskedTextProvider.cs
- GradientStop.cs
- SerializationSectionGroup.cs
- ElementsClipboardData.cs
- PackageRelationship.cs
- TerminateWorkflow.cs
- ConversionHelper.cs