共用方式為


ConfigurationAttribute.Value 屬性

定義

取得組態屬性的值。

public:
 property System::Object ^ Value { System::Object ^ get(); void set(System::Object ^ value); };
public object Value { get; set; }
member this.Value : obj with get, set
Public Property Value As Object

屬性值

組態屬性的值。

範例

下列範例會取得每個組態屬性的 Value 屬性值。 此程式碼範例是針對 類別提供的較大範例的 ConfigurationAttribute 一部分。

// Get the attributes again, after the commit changes.
Configuration config2 = manager.GetApplicationHostConfiguration();
configSection = config2.GetSection("system.web/anonymousIdentification");
configAttributeCollection = configSection.Attributes;
Console.WriteLine("There are " +
    configAttributeCollection.Count.ToString() +
    " Configuration attributes.");
attribute = configAttributeCollection[1];
Console.WriteLine("metadata: " +
    attribute.GetMetadata("encryptionProvider"));
// Display each configuration attribute with properties and metadata.
foreach (ConfigurationAttribute configAttribute in configAttributeCollection)
{
    Console.WriteLine("\t{0}\t{1}\t{2}\t{3}",
         configAttribute.Name,
         configAttribute.Value,
         configAttribute.IsProtected,
         configAttribute.GetMetadata("encryptionProvider"));
}

備註

組態屬性值不是強型別。 此屬性的值必須明確地轉換成正確的類型。

適用於