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
- EnumValidator.cs
- SpellCheck.cs
- Matrix.cs
- CompilerScopeManager.cs
- Menu.cs
- DependencyPropertyConverter.cs
- XmlSchemaAny.cs
- SemaphoreSecurity.cs
- CollectionEditVerbManager.cs
- FlowNode.cs
- DataGridViewColumnCollection.cs
- SimpleHandlerFactory.cs
- IdleTimeoutMonitor.cs
- MenuItemStyleCollection.cs
- Debug.cs
- RuntimeArgumentHandle.cs
- ContentPropertyAttribute.cs
- WindowsListViewGroupSubsetLink.cs
- DeobfuscatingStream.cs
- SafeEventHandle.cs
- PerformanceCounterPermissionAttribute.cs
- ContainerTracking.cs
- TextBlockAutomationPeer.cs
- PriorityBinding.cs
- DragStartedEventArgs.cs
- XsltContext.cs
- MultiBindingExpression.cs
- RemotingConfiguration.cs
- StagingAreaInputItem.cs
- MD5CryptoServiceProvider.cs
- MailMessageEventArgs.cs
- InkCanvasInnerCanvas.cs
- Types.cs
- ThreadStateException.cs
- SystemFonts.cs
- SystemIcons.cs
- QilDataSource.cs
- WindowsFormsHostPropertyMap.cs
- DocumentReference.cs
- HttpApplicationFactory.cs
- TrackingAnnotationCollection.cs
- ExceptionRoutedEventArgs.cs
- SHA1.cs
- WindowsUserNameSecurityTokenAuthenticator.cs
- ModelEditingScope.cs
- RelatedPropertyManager.cs
- HWStack.cs
- Run.cs
- OdbcUtils.cs
- SizeFConverter.cs
- SessionState.cs
- ContractComponent.cs
- BitmapEncoder.cs
- XmlQueryContext.cs
- EventLogException.cs
- SupportingTokenProviderSpecification.cs
- DataSourceControlBuilder.cs
- Helper.cs
- DocumentViewerConstants.cs
- NameValueFileSectionHandler.cs
- Cell.cs
- tooltip.cs
- BinaryOperationBinder.cs
- LifetimeServices.cs
- OracleRowUpdatingEventArgs.cs
- SelectionProcessor.cs
- Preprocessor.cs
- ConfigDefinitionUpdates.cs
- TemplateXamlTreeBuilder.cs
- CodeDefaultValueExpression.cs
- versioninfo.cs
- DetailsViewRow.cs
- XmlBaseWriter.cs
- StylusPointPropertyInfoDefaults.cs
- AttachmentService.cs
- WebPartVerbCollection.cs
- RepeaterItemCollection.cs
- AliasedSlot.cs
- RectangleHotSpot.cs
- WaitHandle.cs
- ToolTip.cs
- DataGridView.cs
- HtmlTitle.cs
- HelpInfo.cs
- CompositeFontFamily.cs
- ObjectDataProvider.cs
- StorageAssociationSetMapping.cs
- SystemInfo.cs
- ToolStripContainer.cs
- InfoCardTrace.cs
- ArrayElementGridEntry.cs
- PageThemeCodeDomTreeGenerator.cs
- LostFocusEventManager.cs
- SizeF.cs
- MarkedHighlightComponent.cs
- MethodToken.cs
- WmlCommandAdapter.cs
- Msec.cs
- FormViewRow.cs
- XPathNodeHelper.cs