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
- SyntaxCheck.cs
- ImageListImageEditor.cs
- VScrollProperties.cs
- SafeNativeMethods.cs
- XamlStackWriter.cs
- TemplateComponentConnector.cs
- _NestedSingleAsyncResult.cs
- SourceFileBuildProvider.cs
- WebPartZoneBaseDesigner.cs
- XmlNamespaceManager.cs
- ClassImporter.cs
- NumberFormatter.cs
- GuidTagList.cs
- StrongNameIdentityPermission.cs
- PresentationAppDomainManager.cs
- TemplatedMailWebEventProvider.cs
- CompiledIdentityConstraint.cs
- Tracking.cs
- PartialCachingAttribute.cs
- mda.cs
- SplitterPanel.cs
- CodeIdentifiers.cs
- MailBnfHelper.cs
- SqlGenericUtil.cs
- MasterPageParser.cs
- TTSEvent.cs
- StringExpressionSet.cs
- UnsafeNetInfoNativeMethods.cs
- BaseProcessor.cs
- SafeRightsManagementHandle.cs
- XmlHierarchyData.cs
- StylusPointPropertyInfoDefaults.cs
- DbConnectionStringCommon.cs
- _ListenerResponseStream.cs
- RotateTransform.cs
- PrintDialog.cs
- Parser.cs
- OracleBFile.cs
- ValidatedControlConverter.cs
- ButtonAutomationPeer.cs
- ProxyFragment.cs
- _emptywebproxy.cs
- StylusShape.cs
- HashSetEqualityComparer.cs
- FixedDocumentPaginator.cs
- ExceptionHandlers.cs
- TextParagraphProperties.cs
- ClientBase.cs
- HierarchicalDataSourceControl.cs
- ReferenceEqualityComparer.cs
- DataGridViewRowEventArgs.cs
- EventLog.cs
- SymbolMethod.cs
- VectorConverter.cs
- BrowserDefinition.cs
- NamedObject.cs
- PropertyGridView.cs
- Application.cs
- CommandID.cs
- BinarySerializer.cs
- ArrayConverter.cs
- XmlNamedNodeMap.cs
- X509ServiceCertificateAuthenticationElement.cs
- DesignerTransactionCloseEvent.cs
- CapabilitiesSection.cs
- UserControl.cs
- IssuanceTokenProviderState.cs
- Rotation3DKeyFrameCollection.cs
- WizardPanel.cs
- PickBranch.cs
- StoreItemCollection.cs
- TabControlCancelEvent.cs
- ItemCheckedEvent.cs
- SqlDataSourceTableQuery.cs
- ApplicationServiceManager.cs
- ToolboxItemAttribute.cs
- HandleRef.cs
- ConfigurationLoaderException.cs
- TraceContext.cs
- EntityDataSourceStatementEditor.cs
- ViewManagerAttribute.cs
- CircleHotSpot.cs
- HttpRequestCacheValidator.cs
- MergeLocalizationDirectives.cs
- TextEditorTyping.cs
- MembershipSection.cs
- SystemIPAddressInformation.cs
- WebPartZoneAutoFormat.cs
- ItemDragEvent.cs
- NamedPipeTransportBindingElement.cs
- SpecularMaterial.cs
- SimpleType.cs
- ExpressionBindingCollection.cs
- XmlLanguage.cs
- AnimatedTypeHelpers.cs
- Logging.cs
- TraceFilter.cs
- ApplicationDirectory.cs
- ForeignConstraint.cs
- Adorner.cs