Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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));
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// 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));
}
}
}
// 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
- SerializableAttribute.cs
- FunctionImportElement.cs
- XmlLanguageConverter.cs
- DoubleLinkList.cs
- Cursor.cs
- FilteredDataSetHelper.cs
- Debug.cs
- FileDialogCustomPlacesCollection.cs
- ResourceKey.cs
- DataObjectEventArgs.cs
- DashStyle.cs
- ContainerUIElement3D.cs
- Rfc2898DeriveBytes.cs
- AppSettingsExpressionBuilder.cs
- ThemeDictionaryExtension.cs
- C14NUtil.cs
- DataGridViewTextBoxEditingControl.cs
- HttpCacheVary.cs
- TextTreeRootNode.cs
- NativeMethods.cs
- HtmlElementEventArgs.cs
- DiffuseMaterial.cs
- EventLogRecord.cs
- SafeNativeMemoryHandle.cs
- IRCollection.cs
- WebAdminConfigurationHelper.cs
- FormViewRow.cs
- StatusBar.cs
- ISAPIWorkerRequest.cs
- SqlDelegatedTransaction.cs
- AnnotationAdorner.cs
- StreamAsIStream.cs
- AssociationTypeEmitter.cs
- Int64Converter.cs
- PageHandlerFactory.cs
- SettingsPropertyNotFoundException.cs
- HttpConfigurationContext.cs
- CompilationUnit.cs
- ScriptingSectionGroup.cs
- Clipboard.cs
- _Connection.cs
- XmlChoiceIdentifierAttribute.cs
- VectorValueSerializer.cs
- StopStoryboard.cs
- XmlSchemaSimpleContent.cs
- EnvelopeVersion.cs
- WindowsListViewGroupHelper.cs
- Processor.cs
- Odbc32.cs
- IdentityReference.cs
- CatchDesigner.xaml.cs
- ExponentialEase.cs
- MetadataArtifactLoaderFile.cs
- ReaderContextStackData.cs
- BevelBitmapEffect.cs
- ProxyDataContractResolver.cs
- ChannelDemuxer.cs
- AuthorizationRule.cs
- Stroke.cs
- RuntimeConfig.cs
- MetadataSerializer.cs
- ProjectionPlan.cs
- SizeAnimationClockResource.cs
- AssemblyNameProxy.cs
- WebBrowserBase.cs
- MenuItemBindingCollection.cs
- DataObjectCopyingEventArgs.cs
- DesignerAdapterAttribute.cs
- CasesDictionary.cs
- NativeMethods.cs
- DesignerVerb.cs
- TextEffect.cs
- XmlSignificantWhitespace.cs
- COM2FontConverter.cs
- XmlSortKey.cs
- PageAsyncTask.cs
- ForEachAction.cs
- Encoder.cs
- OleDbReferenceCollection.cs
- ExpressionPrefixAttribute.cs
- ExternalException.cs
- SystemInformation.cs
- ClientViaElement.cs
- ComponentManagerBroker.cs
- FilterableAttribute.cs
- DiagnosticSection.cs
- precedingquery.cs
- SQLInt16.cs
- PagerSettings.cs
- ProviderConnectionPointCollection.cs
- SingleStorage.cs
- UserControlCodeDomTreeGenerator.cs
- PersonalizationDictionary.cs
- HwndSourceParameters.cs
- XsdBuildProvider.cs
- IdlingCommunicationPool.cs
- versioninfo.cs
- ChtmlCommandAdapter.cs
- ParameterModifier.cs
- ClientTargetCollection.cs