ConfigurationProperty Construtores

Definição

Inicializa uma nova instância da classe ConfigurationProperty.

Sobrecargas

ConfigurationProperty(String, Type)

Esta API dá suporte à infraestrutura do produto e não deve ser usada diretamente do seu código.

Inicializa uma nova instância da classe ConfigurationProperty.

ConfigurationProperty(String, Type, Object)

Esta API dá suporte à infraestrutura do produto e não deve ser usada diretamente do seu código.

Inicializa uma nova instância da classe ConfigurationProperty.

ConfigurationProperty(String, Type, Object, ConfigurationPropertyOptions)

Esta API dá suporte à infraestrutura do produto e não deve ser usada diretamente do seu código.

Inicializa uma nova instância da classe ConfigurationProperty.

ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions)

Esta API dá suporte à infraestrutura do produto e não deve ser usada diretamente do seu código.

Inicializa uma nova instância da classe ConfigurationProperty.

ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions, String)

Esta API dá suporte à infraestrutura do produto e não deve ser usada diretamente do seu código.

Inicializa uma nova instância da classe ConfigurationProperty.

ConfigurationProperty(String, Type)

Origem:
ConfigurationProperty.cs
Origem:
ConfigurationProperty.cs
Origem:
ConfigurationProperty.cs

Inicializa uma nova instância da classe ConfigurationProperty.

Esta API dá suporte à infraestrutura do produto e não deve ser usada diretamente do seu código.

C#
public ConfigurationProperty (string name, Type type);

Parâmetros

name
String

O nome da entidade de configuração.

type
Type

O tipo da entidade de configuração.

Aplica-se a

.NET Framework 4.8.1 e outras versões
Produto Versões
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

ConfigurationProperty(String, Type, Object)

Origem:
ConfigurationProperty.cs
Origem:
ConfigurationProperty.cs
Origem:
ConfigurationProperty.cs

Inicializa uma nova instância da classe ConfigurationProperty.

Esta API dá suporte à infraestrutura do produto e não deve ser usada diretamente do seu código.

C#
public ConfigurationProperty (string name, Type type, object defaultValue);

Parâmetros

name
String

O nome da entidade de configuração.

type
Type

O tipo da entidade de configuração.

defaultValue
Object

O valor padrão da entidade de configuração.

Exemplos

O exemplo de código a seguir mostra como usar o ConfigurationProperty.ConfigurationProperty(String, Type, Object) construtor para instanciar um objeto configuration-property.

C#
// Initialize the _FileName property
_FileName =
    new ConfigurationProperty("fileName",
    typeof(string), "default.txt");

Comentários

Quando você cria uma instância de um ConfigurationProperty objeto usando esse construtor, as IsRequired propriedades e IsKey são definidas como false. Além disso, uma instância feita com esse construtor não funcionará como uma propriedade de chave de coleção padrão.

Confira também

Aplica-se a

.NET Framework 4.8.1 e outras versões
Produto Versões
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

ConfigurationProperty(String, Type, Object, ConfigurationPropertyOptions)

Origem:
ConfigurationProperty.cs
Origem:
ConfigurationProperty.cs
Origem:
ConfigurationProperty.cs

Inicializa uma nova instância da classe ConfigurationProperty.

Esta API dá suporte à infraestrutura do produto e não deve ser usada diretamente do seu código.

C#
public ConfigurationProperty (string name, Type type, object defaultValue, System.Configuration.ConfigurationPropertyOptions options);

Parâmetros

name
String

O nome da entidade de configuração.

type
Type

O tipo da entidade de configuração.

defaultValue
Object

O valor padrão da entidade de configuração.

options
ConfigurationPropertyOptions

Um dos valores de enumeração ConfigurationPropertyOptions.

Exemplos

O exemplo de código a seguir mostra como usar ConfigurationProperty.ConfigurationProperty(String, Type, Object, ConfigurationPropertyOptions) o construtor para instanciar um objeto configuration-property.

C#
// Initialize the _MaxUsers property
_MaxUsers =
    new ConfigurationProperty("maxUsers",
    typeof(long), (long)1000,
    ConfigurationPropertyOptions.None);

Confira também

Aplica-se a

.NET Framework 4.8.1 e outras versões
Produto Versões
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions)

Origem:
ConfigurationProperty.cs
Origem:
ConfigurationProperty.cs
Origem:
ConfigurationProperty.cs

Inicializa uma nova instância da classe ConfigurationProperty.

Esta API dá suporte à infraestrutura do produto e não deve ser usada diretamente do seu código.

C#
public ConfigurationProperty (string name, Type type, object defaultValue, System.ComponentModel.TypeConverter typeConverter, System.Configuration.ConfigurationValidatorBase validator, System.Configuration.ConfigurationPropertyOptions options);

Parâmetros

name
String

O nome da entidade de configuração.

type
Type

O tipo da entidade de configuração.

defaultValue
Object

O valor padrão da entidade de configuração.

typeConverter
TypeConverter

O tipo do conversor a ser aplicado.

validator
ConfigurationValidatorBase

O validador a ser usado.

options
ConfigurationPropertyOptions

Um dos valores de enumeração ConfigurationPropertyOptions.

Exemplos

O exemplo de código a seguir mostra o tipo de parâmetros a serem usados ao chamar o ConfigurationProperty.ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions) construtor.

C#
// Initialize the _MaxIdleTime property
TimeSpan minTime = TimeSpan.FromSeconds(30);
TimeSpan maxTime = TimeSpan.FromMinutes(5);

ConfigurationValidatorBase _TimeSpanValidator =
    new TimeSpanValidator(minTime, maxTime, false);

_MaxIdleTime =
    new ConfigurationProperty("maxIdleTime",
    typeof(TimeSpan), TimeSpan.FromMinutes(5),
    TypeDescriptor.GetConverter(typeof(TimeSpan)),
    _TimeSpanValidator,
    ConfigurationPropertyOptions.IsRequired,
    "[Description:This is the max idle time.]");

Confira também

Aplica-se a

.NET Framework 4.8.1 e outras versões
Produto Versões
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions, String)

Origem:
ConfigurationProperty.cs
Origem:
ConfigurationProperty.cs
Origem:
ConfigurationProperty.cs

Inicializa uma nova instância da classe ConfigurationProperty.

Esta API dá suporte à infraestrutura do produto e não deve ser usada diretamente do seu código.

C#
public ConfigurationProperty (string name, Type type, object defaultValue, System.ComponentModel.TypeConverter typeConverter, System.Configuration.ConfigurationValidatorBase validator, System.Configuration.ConfigurationPropertyOptions options, string description);

Parâmetros

name
String

O nome da entidade de configuração.

type
Type

O tipo da entidade de configuração.

defaultValue
Object

O valor padrão da entidade de configuração.

typeConverter
TypeConverter

O tipo do conversor a ser aplicado.

validator
ConfigurationValidatorBase

O validador a ser usado.

options
ConfigurationPropertyOptions

Um dos valores de enumeração ConfigurationPropertyOptions.

description
String

A descrição da entidade de configuração.

Exemplos

O exemplo de código a seguir mostra como usar o ConfigurationProperty.ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions, String) construtor para instanciar um objeto configuration-property.

C#
// Initialize the _MaxIdleTime property
TimeSpan minTime = TimeSpan.FromSeconds(30);
TimeSpan maxTime = TimeSpan.FromMinutes(5);

ConfigurationValidatorBase _TimeSpanValidator =
    new TimeSpanValidator(minTime, maxTime, false);

_MaxIdleTime =
    new ConfigurationProperty("maxIdleTime",
    typeof(TimeSpan), TimeSpan.FromMinutes(5),
    TypeDescriptor.GetConverter(typeof(TimeSpan)),
    _TimeSpanValidator,
    ConfigurationPropertyOptions.IsRequired,
    "[Description:This is the max idle time.]");

Confira também

Aplica-se a

.NET Framework 4.8.1 e outras versões
Produto Versões
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9