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
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.

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

Parameters

name
String

The name of the configuration entity.

type
Type

The type of the configuration entity.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.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
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ConfigurationProperty(String, Type, Object)

Source:
ConfigurationProperty.cs
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.

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

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.

C#
// Initialize the _FileName property
_FileName =
    new ConfigurationProperty("fileName",
    typeof(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

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.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
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ConfigurationProperty(String, Type, Object, ConfigurationPropertyOptions)

Source:
ConfigurationProperty.cs
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.

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

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.

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

See also

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.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
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

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

Source:
ConfigurationProperty.cs
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.

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

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.

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.]");

See also

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.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
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

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

Source:
ConfigurationProperty.cs
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.

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

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.

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.]");

See also

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.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
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10