Share via


NameValueConfigurationCollection.Item[String] 属性

定义

基于所提供的参数,获取或设置 NameValueConfigurationElement 对象。

public:
 property System::Configuration::NameValueConfigurationElement ^ default[System::String ^] { System::Configuration::NameValueConfigurationElement ^ get(System::String ^ name); void set(System::String ^ name, System::Configuration::NameValueConfigurationElement ^ value); };
public System.Configuration.NameValueConfigurationElement this[string name] { get; set; }
member this.Item(string) : System.Configuration.NameValueConfigurationElement with get, set
Default Public Property Item(name As String) As NameValueConfigurationElement

参数

name
String

集合中包含的 NameValueConfigurationElement 的名称。

属性值

NameValueConfigurationElement 对象。

示例

下面的代码示例演示如何使用 Item[] 属性。 此代码示例是为 NameValueConfigurationCollection 类提供的一个更大示例的一部分。

// Item property.
Console.WriteLine("Value of property 'enabled': {0}",
 myNameValConfigCollection["enabled"].Value);
' Item property.
Console.WriteLine("Value of property 'enabled': {0}", myNameValConfigCollection("enabled").Value)

注解

Item[]使用 属性获取或设置NameValueConfigurationElement基于 参数的对象name

适用于