Επεξεργασία

Κοινή χρήση μέσω


ConfigurationProperty Constructors

Definition

Initializes a new instance of the ConfigurationProperty class.

Overloads

ConfigurationProperty(String, Type)

This API supports the product infrastructure and is not intended to be used directly from your code.

Initializes a new instance of the ConfigurationProperty class.

ConfigurationProperty(String, Type, Object)

This API supports the product infrastructure and is not intended to be used directly from your code.

Initializes a new instance of the ConfigurationProperty class.

ConfigurationProperty(String, Type, Object, ConfigurationPropertyOptions)

This API supports the product infrastructure and is not intended to be used directly from your code.

Initializes a new instance of the ConfigurationProperty class.

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

This API supports the product infrastructure and is not intended to be used directly from your code.

Initializes a new instance of the ConfigurationProperty class.

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

This API supports the product infrastructure and is not intended to be used directly from your code.

Initializes a new instance of the ConfigurationProperty class.

ConfigurationProperty(String, Type)

Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs

Initializes a new instance of the ConfigurationProperty class.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 ConfigurationProperty(System::String ^ name, Type ^ type);
public ConfigurationProperty (string name, Type type);
new System.Configuration.ConfigurationProperty : string * Type -> System.Configuration.ConfigurationProperty
Public Sub New (name As String, type As Type)

Parameters

name
String

The name of the configuration entity.

type
Type

The type of the configuration entity.

Applies to

ConfigurationProperty(String, Type, Object)

Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs

Initializes a new instance of the ConfigurationProperty class.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 ConfigurationProperty(System::String ^ name, Type ^ type, System::Object ^ defaultValue);
public ConfigurationProperty (string name, Type type, object defaultValue);
new System.Configuration.ConfigurationProperty : string * Type * obj -> System.Configuration.ConfigurationProperty
Public Sub New (name As String, type As Type, defaultValue As Object)

Parameters

name
String

The name of the configuration entity.

type
Type

The type of the configuration entity.

defaultValue
Object

The default value of the configuration entity.

Examples

The following code example shows how to use the ConfigurationProperty.ConfigurationProperty(String, Type, Object) constructor to instantiate a configuration-property object.

// Initialize the _FileName property
_FileName =
    new ConfigurationProperty("fileName",
    typeof(string), "default.txt");
' Initialize the _FileName property
_FileName = New ConfigurationProperty( _
    "fileName", GetType(String), "default.txt")

Remarks

When you instantiate a ConfigurationProperty object using this constructor, the IsRequired and IsKey properties are set to false. Additionally, an instance made with this constructor will not function as a default collection-key property.

See also

Applies to

ConfigurationProperty(String, Type, Object, ConfigurationPropertyOptions)

Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs

Initializes a new instance of the ConfigurationProperty class.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 ConfigurationProperty(System::String ^ name, Type ^ type, System::Object ^ defaultValue, System::Configuration::ConfigurationPropertyOptions options);
public ConfigurationProperty (string name, Type type, object defaultValue, System.Configuration.ConfigurationPropertyOptions options);
new System.Configuration.ConfigurationProperty : string * Type * obj * System.Configuration.ConfigurationPropertyOptions -> System.Configuration.ConfigurationProperty
Public Sub New (name As String, type As Type, defaultValue As Object, options As ConfigurationPropertyOptions)

Parameters

name
String

The name of the configuration entity.

type
Type

The type of the configuration entity.

defaultValue
Object

The default value of the configuration entity.

options
ConfigurationPropertyOptions

One of the ConfigurationPropertyOptions enumeration values.

Examples

The following code example shows how to use ConfigurationProperty.ConfigurationProperty(String, Type, Object, ConfigurationPropertyOptions) constructor to instantiate a configuration-property object.

// Initialize the _MaxUsers property
_MaxUsers =
    new ConfigurationProperty("maxUsers",
    typeof(long), (long)1000,
    ConfigurationPropertyOptions.None);
' Initialize the _MaxUsers property
_MaxUsers = New ConfigurationProperty( _
    "maxUsers", GetType(Long), 1000L, _
    ConfigurationPropertyOptions.None)

See also

Applies to

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

Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs

Initializes a new instance of the ConfigurationProperty class.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 ConfigurationProperty(System::String ^ name, Type ^ type, System::Object ^ defaultValue, System::ComponentModel::TypeConverter ^ typeConverter, System::Configuration::ConfigurationValidatorBase ^ validator, System::Configuration::ConfigurationPropertyOptions options);
public ConfigurationProperty (string name, Type type, object defaultValue, System.ComponentModel.TypeConverter typeConverter, System.Configuration.ConfigurationValidatorBase validator, System.Configuration.ConfigurationPropertyOptions options);
new System.Configuration.ConfigurationProperty : string * Type * obj * System.ComponentModel.TypeConverter * System.Configuration.ConfigurationValidatorBase * System.Configuration.ConfigurationPropertyOptions -> System.Configuration.ConfigurationProperty
Public Sub New (name As String, type As Type, defaultValue As Object, typeConverter As TypeConverter, validator As ConfigurationValidatorBase, options As ConfigurationPropertyOptions)

Parameters

name
String

The name of the configuration entity.

type
Type

The type of the configuration entity.

defaultValue
Object

The default value of the configuration entity.

typeConverter
TypeConverter

The type of the converter to apply.

validator
ConfigurationValidatorBase

The validator to use.

options
ConfigurationPropertyOptions

One of the ConfigurationPropertyOptions enumeration values.

Examples

The following code example shows the kind of parameters to use when calling the ConfigurationProperty.ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions) constructor.

// 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.]");
' Initialize the _MaxIdleTime property
Dim minTime As TimeSpan = TimeSpan.FromSeconds(30)
Dim maxTime As TimeSpan = TimeSpan.FromMinutes(5)
Dim _TimeSpanValidator = _
    New TimeSpanValidator(minTime, maxTime, False)

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

See also

Applies to

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

Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs
Source:
ConfigurationProperty.cs

Initializes a new instance of the ConfigurationProperty class.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 ConfigurationProperty(System::String ^ name, Type ^ type, System::Object ^ defaultValue, System::ComponentModel::TypeConverter ^ typeConverter, System::Configuration::ConfigurationValidatorBase ^ validator, System::Configuration::ConfigurationPropertyOptions options, System::String ^ description);
public ConfigurationProperty (string name, Type type, object defaultValue, System.ComponentModel.TypeConverter typeConverter, System.Configuration.ConfigurationValidatorBase validator, System.Configuration.ConfigurationPropertyOptions options, string description);
new System.Configuration.ConfigurationProperty : string * Type * obj * System.ComponentModel.TypeConverter * System.Configuration.ConfigurationValidatorBase * System.Configuration.ConfigurationPropertyOptions * string -> System.Configuration.ConfigurationProperty
Public Sub New (name As String, type As Type, defaultValue As Object, typeConverter As TypeConverter, validator As ConfigurationValidatorBase, options As ConfigurationPropertyOptions, description As String)

Parameters

name
String

The name of the configuration entity.

type
Type

The type of the configuration entity.

defaultValue
Object

The default value of the configuration entity.

typeConverter
TypeConverter

The type of the converter to apply.

validator
ConfigurationValidatorBase

The validator to use.

options
ConfigurationPropertyOptions

One of the ConfigurationPropertyOptions enumeration values.

description
String

The description of the configuration entity.

Examples

The following code example shows how to use the ConfigurationProperty.ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions, String) constructor to instantiate a configuration-property object.

// 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.]");
' Initialize the _MaxIdleTime property
Dim minTime As TimeSpan = TimeSpan.FromSeconds(30)
Dim maxTime As TimeSpan = TimeSpan.FromMinutes(5)
Dim _TimeSpanValidator = _
    New TimeSpanValidator(minTime, maxTime, False)

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

See also

Applies to