ElementInformation.Properties Proprietà

Definizione

Ottiene un insieme PropertyInformationCollection delle proprietà contenute nell'oggetto ConfigurationElement associato.

public:
 property System::Configuration::PropertyInformationCollection ^ Properties { System::Configuration::PropertyInformationCollection ^ get(); };
public System.Configuration.PropertyInformationCollection Properties { get; }
member this.Properties : System.Configuration.PropertyInformationCollection
Public ReadOnly Property Properties As PropertyInformationCollection

Valore della proprietà

Insieme PropertyInformationCollection delle proprietà contenute nell'oggetto ConfigurationElement associato.

Esempio

Nell'esempio seguente viene illustrato come ottenere la Properties raccolta.

       static public void GetElementProperties()
       {

           // Get the current configuration file.
           System.Configuration.Configuration config =
                   ConfigurationManager.OpenExeConfiguration(
                   ConfigurationUserLevel.None);

           // Get the section.
           UrlsSection section =
               (UrlsSection)config.GetSection("MyUrls");

           // Get the element.
           UrlConfigElement url = section.Simple;

           // Get the element properties.
           PropertyInformationCollection properties =
               url.ElementInformation.Properties;

           foreach (PropertyInformation prop in properties)
           {
               Console.WriteLine(
                   "Name: {0} Type: {1}", prop.Name,
                   prop.Type.ToString());
           }
       }
Public Shared Sub GetElementProperties() 
    
    ' Get the current configuration file.
    Dim config _
    As System.Configuration.Configuration = _
    ConfigurationManager.OpenExeConfiguration( _
    ConfigurationUserLevel.None)

    ' Get the section.
    Dim section As UrlsSection = _
    CType(config.GetSection("MyUrls"), UrlsSection)
    
    ' Get the element.
    Dim url As UrlConfigElement = _
    section.Simple
    
    ' Get the element properties.
    Dim properties _
    As PropertyInformationCollection = _
    url.ElementInformation.Properties
    
    Dim prop As PropertyInformation
    For Each prop In  properties
        Console.WriteLine("Name: {0} Type: {1}", _
        prop.Name, prop.Type.ToString())
    Next prop

End Sub

Commenti

Le proprietà di un ConfigurationElement oggetto sono gli attributi e i sottoelementi associati a tale elemento di configurazione nel file di configurazione.

Si applica a