Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / System / Collections / Specialized / StringDictionary.cs / 1 / StringDictionary.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
*/
namespace System.Collections.Specialized {
using System.Runtime.InteropServices;
using System.Diagnostics;
using System;
using System.Collections;
using System.ComponentModel.Design.Serialization;
using System.Globalization;
///
/// Implements a hashtable with the key strongly typed to be
/// a string rather than an object.
///
[Serializable]
[DesignerSerializer("System.Diagnostics.Design.StringDictionaryCodeDomSerializer, " + AssemblyRef.SystemDesign, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + AssemblyRef.SystemDesign)]
public class StringDictionary : IEnumerable {
internal Hashtable contents = new Hashtable();
///
/// Initializes a new instance of the System.Windows.Forms.StringDictionary class.
///
public StringDictionary() {
}
///
/// Gets the number of key-and-value pairs in the System.Windows.Forms.StringDictionary.
///
public virtual int Count {
get {
return contents.Count;
}
}
///
/// Indicates whether access to the System.Windows.Forms.StringDictionary is synchronized (thread-safe). This property is
/// read-only.
///
public virtual bool IsSynchronized {
get {
return contents.IsSynchronized;
}
}
///
/// Gets or sets the value associated with the specified key.
///
public virtual string this[string key] {
get {
if( key == null ) {
throw new ArgumentNullException("key");
}
return (string) contents[key.ToLower(CultureInfo.InvariantCulture)];
}
set {
if( key == null ) {
throw new ArgumentNullException("key");
}
contents[key.ToLower(CultureInfo.InvariantCulture)] = value;
}
}
///
/// Gets a collection of keys in the System.Windows.Forms.StringDictionary.
///
public virtual ICollection Keys {
get {
return contents.Keys;
}
}
///
/// Gets an object that can be used to synchronize access to the System.Windows.Forms.StringDictionary.
///
public virtual object SyncRoot {
get {
return contents.SyncRoot;
}
}
///
/// Gets a collection of values in the System.Windows.Forms.StringDictionary.
///
public virtual ICollection Values {
get {
return contents.Values;
}
}
///
/// Adds an entry with the specified key and value into the System.Windows.Forms.StringDictionary.
///
public virtual void Add(string key, string value) {
if( key == null ) {
throw new ArgumentNullException("key");
}
contents.Add(key.ToLower(CultureInfo.InvariantCulture), value);
}
///
/// Removes all entries from the System.Windows.Forms.StringDictionary.
///
public virtual void Clear() {
contents.Clear();
}
///
/// Determines if the string dictionary contains a specific key
///
public virtual bool ContainsKey(string key) {
if( key == null ) {
throw new ArgumentNullException("key");
}
return contents.ContainsKey(key.ToLower(CultureInfo.InvariantCulture));
}
///
/// Determines if the System.Windows.Forms.StringDictionary contains a specific value.
///
public virtual bool ContainsValue(string value) {
return contents.ContainsValue(value);
}
///
/// Copies the string dictionary values to a one-dimensional instance at the
/// specified index.
///
public virtual void CopyTo(Array array, int index) {
contents.CopyTo(array, index);
}
///
/// Returns an enumerator that can iterate through the string dictionary.
///
public virtual IEnumerator GetEnumerator() {
return contents.GetEnumerator();
}
///
/// Removes the entry with the specified key from the string dictionary.
///
public virtual void Remove(string key) {
if( key == null ) {
throw new ArgumentNullException("key");
}
contents.Remove(key.ToLower(CultureInfo.InvariantCulture));
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HtmlSelect.cs
- MetadataProperty.cs
- WindowsListViewGroupHelper.cs
- _SslState.cs
- RichTextBox.cs
- iisPickupDirectory.cs
- SystemDiagnosticsSection.cs
- SQLChars.cs
- RpcAsyncResult.cs
- XappLauncher.cs
- Formatter.cs
- XsdBuildProvider.cs
- Variable.cs
- LabelInfo.cs
- Vector.cs
- ComponentRenameEvent.cs
- CatalogPartChrome.cs
- ObjectCloneHelper.cs
- ADMembershipUser.cs
- WebScriptEndpoint.cs
- WebHttpBinding.cs
- CodeConstructor.cs
- ColorContextHelper.cs
- SchemaElement.cs
- RelationshipEndCollection.cs
- UdpRetransmissionSettings.cs
- TextElementCollection.cs
- ContractBase.cs
- MessageHeader.cs
- Size3D.cs
- RouteItem.cs
- ResourceAssociationTypeEnd.cs
- COMException.cs
- UnsafeNativeMethodsMilCoreApi.cs
- DrawingAttributes.cs
- IntegerValidatorAttribute.cs
- DesignerMetadata.cs
- PrinterResolution.cs
- DataGridPagingPage.cs
- XmlCharType.cs
- RecognizerInfo.cs
- CacheMemory.cs
- PlatformCulture.cs
- ExtendedPropertiesHandler.cs
- CriticalExceptions.cs
- DesignTable.cs
- Convert.cs
- PrivateFontCollection.cs
- CryptoStream.cs
- BinaryNode.cs
- SafeCryptoHandles.cs
- WorkflowApplicationIdleEventArgs.cs
- HostDesigntimeLicenseContext.cs
- GridViewAutomationPeer.cs
- _BufferOffsetSize.cs
- BooleanSwitch.cs
- Thumb.cs
- AsnEncodedData.cs
- OdbcError.cs
- SchemaDeclBase.cs
- SearchForVirtualItemEventArgs.cs
- RpcCryptoContext.cs
- TraceListeners.cs
- MetadataItem_Static.cs
- CatalogZone.cs
- ComponentDispatcherThread.cs
- PathBox.cs
- FastEncoderWindow.cs
- TemplateLookupAction.cs
- EntryPointNotFoundException.cs
- DescendantBaseQuery.cs
- UnsafeNetInfoNativeMethods.cs
- XmlNodeList.cs
- TcpChannelListener.cs
- DataBindingCollection.cs
- Variant.cs
- TemplateBindingExpressionConverter.cs
- TextPointerBase.cs
- DependencyProperty.cs
- DesignerWithHeader.cs
- DurationConverter.cs
- EarlyBoundInfo.cs
- LifetimeMonitor.cs
- ObsoleteAttribute.cs
- ActivityBuilderHelper.cs
- HttpContext.cs
- SystemWebExtensionsSectionGroup.cs
- ActivationServices.cs
- ExpressionWriter.cs
- RegisteredArrayDeclaration.cs
- ConfigXmlCDataSection.cs
- ScrollableControlDesigner.cs
- GridViewColumn.cs
- infer.cs
- EntityReference.cs
- FontNamesConverter.cs
- BufferedGraphics.cs
- DataGridViewCellCancelEventArgs.cs
- SmtpClient.cs
- ExcCanonicalXml.cs