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
- EventWaitHandleSecurity.cs
- PeerContact.cs
- DiscoveryMessageSequenceGenerator.cs
- WebHeaderCollection.cs
- DbConnectionInternal.cs
- InputMethod.cs
- CompositeKey.cs
- SecurityDescriptor.cs
- EventWaitHandle.cs
- Win32KeyboardDevice.cs
- PageAction.cs
- StringSource.cs
- ImmutableAssemblyCacheEntry.cs
- KoreanLunisolarCalendar.cs
- ExceptionRoutedEventArgs.cs
- SchemaCollectionCompiler.cs
- CompoundFileIOPermission.cs
- Gdiplus.cs
- RenderData.cs
- glyphs.cs
- EventSinkHelperWriter.cs
- ChannelManager.cs
- SimpleRecyclingCache.cs
- ZipIOModeEnforcingStream.cs
- QuaternionConverter.cs
- HttpWriter.cs
- LinkLabelLinkClickedEvent.cs
- graph.cs
- SqlDataRecord.cs
- RequiredArgumentAttribute.cs
- DocumentSequenceHighlightLayer.cs
- XmlSchemaSet.cs
- ParameterDataSourceExpression.cs
- DataGridViewCellParsingEventArgs.cs
- EdmValidator.cs
- SqlParameterizer.cs
- DoubleKeyFrameCollection.cs
- DynamicDocumentPaginator.cs
- ComplexPropertyEntry.cs
- BitmapDownload.cs
- UInt32Storage.cs
- HelpKeywordAttribute.cs
- DbMetaDataFactory.cs
- SoapReflector.cs
- BookmarkEventArgs.cs
- ConnectivityStatus.cs
- UnsafeNativeMethods.cs
- XmlSerializer.cs
- RuntimeConfig.cs
- CommandEventArgs.cs
- BindingCollection.cs
- TypeBuilder.cs
- StatusBarPanel.cs
- MonikerHelper.cs
- StylusEditingBehavior.cs
- CodeThrowExceptionStatement.cs
- ModelTreeEnumerator.cs
- SuspendDesigner.cs
- _LoggingObject.cs
- EventHandlerService.cs
- ToolStripSplitButton.cs
- AlphabetConverter.cs
- ReachPageContentCollectionSerializer.cs
- PasswordTextNavigator.cs
- DataTrigger.cs
- ElementUtil.cs
- ValueProviderWrapper.cs
- TextModifierScope.cs
- ArgIterator.cs
- GridViewRowPresenterBase.cs
- SQLGuid.cs
- FormViewDeleteEventArgs.cs
- Stack.cs
- PathGradientBrush.cs
- DesignerObject.cs
- BufferModeSettings.cs
- ReaderWriterLock.cs
- CheckPair.cs
- ZeroOpNode.cs
- MorphHelper.cs
- MsmqHostedTransportManager.cs
- PartialCachingAttribute.cs
- MsmqDecodeHelper.cs
- ResourceCategoryAttribute.cs
- MsmqIntegrationSecurityMode.cs
- WindowsRegion.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- PropertyNames.cs
- WMIGenerator.cs
- ComplexPropertyEntry.cs
- CodePageUtils.cs
- String.cs
- FamilyMapCollection.cs
- HostedHttpRequestAsyncResult.cs
- AssemblyHash.cs
- DataTableReader.cs
- ServiceContractViewControl.cs
- WindowsSolidBrush.cs
- RequestNavigateEventArgs.cs
- ObjectListGeneralPage.cs