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
- IsolatedStorageException.cs
- PropertyGridEditorPart.cs
- SiteMapDataSourceDesigner.cs
- SEHException.cs
- TranslateTransform3D.cs
- TreeNodeBindingCollection.cs
- ClientTargetCollection.cs
- References.cs
- KeyValuePair.cs
- EntityDataSourceDesigner.cs
- XamlInt32CollectionSerializer.cs
- PersonalizationStateQuery.cs
- SapiAttributeParser.cs
- BordersPage.cs
- CryptoKeySecurity.cs
- InkPresenterAutomationPeer.cs
- DataGridViewRowPrePaintEventArgs.cs
- PathFigureCollection.cs
- GridViewRowCollection.cs
- PerfCounters.cs
- ActivityExecutorOperation.cs
- NavigatingCancelEventArgs.cs
- DataServiceClientException.cs
- DbConnectionPoolCounters.cs
- TextWriterTraceListener.cs
- TextBoxAutomationPeer.cs
- MouseWheelEventArgs.cs
- ComUdtElement.cs
- EllipseGeometry.cs
- HtmlInputFile.cs
- KeyPressEvent.cs
- RecordConverter.cs
- XmlElementList.cs
- TransformerInfoCollection.cs
- _UriTypeConverter.cs
- EmptyEnumerable.cs
- login.cs
- TabControlEvent.cs
- TextSpan.cs
- MetadataItemEmitter.cs
- DataRowCollection.cs
- TrackingExtract.cs
- IdentityHolder.cs
- BaseDataList.cs
- ServiceNameElement.cs
- SmiRequestExecutor.cs
- SQLInt64Storage.cs
- SystemFonts.cs
- TimersDescriptionAttribute.cs
- OleDbInfoMessageEvent.cs
- Binding.cs
- BindingExpressionUncommonField.cs
- LocalizationParserHooks.cs
- RIPEMD160.cs
- ServiceModelExtensionElement.cs
- XpsFilter.cs
- InteropAutomationProvider.cs
- MultipleViewPatternIdentifiers.cs
- TagMapCollection.cs
- NullableDecimalAverageAggregationOperator.cs
- StyleBamlTreeBuilder.cs
- SoundPlayer.cs
- WebPartCloseVerb.cs
- FixedSOMFixedBlock.cs
- DBBindings.cs
- ChtmlTextWriter.cs
- NativeMethods.cs
- BaseUriHelper.cs
- WindowsAuthenticationEventArgs.cs
- BamlCollectionHolder.cs
- Cursor.cs
- UnauthorizedAccessException.cs
- SemanticBasicElement.cs
- KeyedCollection.cs
- CheckBox.cs
- IPipelineRuntime.cs
- DataColumnPropertyDescriptor.cs
- Overlapped.cs
- ReadOnlyCollection.cs
- TemplateInstanceAttribute.cs
- pingexception.cs
- VisualStyleRenderer.cs
- SingleTagSectionHandler.cs
- MultipleViewProviderWrapper.cs
- Html32TextWriter.cs
- XmlParserContext.cs
- DesignTable.cs
- PrinterResolution.cs
- CompiledRegexRunnerFactory.cs
- BinaryMethodMessage.cs
- AuthorizationRuleCollection.cs
- SafeRightsManagementHandle.cs
- HttpHandlerActionCollection.cs
- RuleProcessor.cs
- SQLChars.cs
- HttpModulesSection.cs
- Size3DConverter.cs
- ActionFrame.cs
- ContractComponent.cs
- AlignmentXValidation.cs