Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / Collections / Specialized / StringDictionaryWithComparer.cs / 1305376 / StringDictionaryWithComparer.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- // StringDictionary compares keys by converting them to lowercase first, using the Invariant culture. // This is not the right thing to do for file names, registry keys, environment variable etc. // This internal version of StringDictionary accepts an IEqualityComparer and enables you to // customize the string comparison to be StringComparer.OrdinalIgnoreCase for the above cases. namespace System.Collections.Specialized { using System.Runtime.InteropServices; using System.Diagnostics; using System; using System.Collections; using System.ComponentModel.Design.Serialization; using System.Globalization; [Serializable] internal class StringDictionaryWithComparer : StringDictionary { public StringDictionaryWithComparer() : this(StringComparer.OrdinalIgnoreCase) { } public StringDictionaryWithComparer(IEqualityComparer comparer) { ReplaceHashtable(new Hashtable(comparer)); } public override string this[string key] { get { if( key == null ) { throw new ArgumentNullException("key"); } return (string) contents[key]; } set { if( key == null ) { throw new ArgumentNullException("key"); } contents[key] = value; } } public override void Add(string key, string value) { if( key == null ) { throw new ArgumentNullException("key"); } contents.Add(key, value); } public override bool ContainsKey(string key) { if( key == null ) { throw new ArgumentNullException("key"); } return contents.ContainsKey(key); } public override void Remove(string key) { if( key == null ) { throw new ArgumentNullException("key"); } contents.Remove(key); } } } // 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
- SafeMILHandle.cs
- StaticSiteMapProvider.cs
- IIS7WorkerRequest.cs
- SoapDocumentMethodAttribute.cs
- LazyTextWriterCreator.cs
- ColorConvertedBitmap.cs
- ExpressionNode.cs
- sqlpipe.cs
- Matrix3D.cs
- VectorConverter.cs
- PathFigureCollectionValueSerializer.cs
- DataTrigger.cs
- TableStyle.cs
- SecurityUtils.cs
- AmbientValueAttribute.cs
- HashHelper.cs
- XmlDocumentFragment.cs
- SimpleExpression.cs
- ICspAsymmetricAlgorithm.cs
- CodeNamespace.cs
- SubpageParagraph.cs
- IRCollection.cs
- DataPager.cs
- MemberDescriptor.cs
- CodeNamespaceImport.cs
- CodeFieldReferenceExpression.cs
- ModuleConfigurationInfo.cs
- FrugalList.cs
- NameTable.cs
- XmlSignatureProperties.cs
- cookie.cs
- WebResourceAttribute.cs
- MappingException.cs
- ByteStreamGeometryContext.cs
- SBCSCodePageEncoding.cs
- Camera.cs
- TextDecorationCollection.cs
- webproxy.cs
- EntityDataReader.cs
- GlyphShapingProperties.cs
- TemplateBindingExtension.cs
- _SafeNetHandles.cs
- controlskin.cs
- HorizontalAlignConverter.cs
- DocumentProperties.cs
- TemplateContent.cs
- SeekableReadStream.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- AnnotationResource.cs
- TextDecoration.cs
- GlobalEventManager.cs
- TraceContextEventArgs.cs
- DocumentPaginator.cs
- querybuilder.cs
- FontStyleConverter.cs
- CheckBoxBaseAdapter.cs
- SourceFileInfo.cs
- ClassGenerator.cs
- LexicalChunk.cs
- LazyTextWriterCreator.cs
- XmlCollation.cs
- SimpleType.cs
- LogStore.cs
- ClientData.cs
- OAVariantLib.cs
- Expression.cs
- ObjectStateManagerMetadata.cs
- PeerPresenceInfo.cs
- LightweightEntityWrapper.cs
- EtwProvider.cs
- RepeaterItemCollection.cs
- ListViewSelectEventArgs.cs
- MsmqDecodeHelper.cs
- RequestTimeoutManager.cs
- Brush.cs
- DataError.cs
- GC.cs
- MergeLocalizationDirectives.cs
- NonClientArea.cs
- ServiceCredentials.cs
- ContextDataSourceContextData.cs
- ListViewItem.cs
- NameValuePair.cs
- ContentControl.cs
- ButtonColumn.cs
- Label.cs
- BitmapSource.cs
- _CommandStream.cs
- MediaElementAutomationPeer.cs
- ToolStripProgressBar.cs
- IUnknownConstantAttribute.cs
- XPathNodeInfoAtom.cs
- PackageDigitalSignature.cs
- ConnectionStringSettings.cs
- ComponentDispatcherThread.cs
- StrokeDescriptor.cs
- FixedNode.cs
- AppDomainInfo.cs
- SecurityContext.cs
- XmlCharCheckingWriter.cs