ConfigurationProperty Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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)
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)
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(System::String ^ name, Type ^ type, System::Object ^ default_value);
public ConfigurationProperty (string name, Type type, object defaultValue);
public ConfigurationProperty (string name, Type type, object default_value);
new System.Configuration.ConfigurationProperty : string * Type * obj -> System.Configuration.ConfigurationProperty
new System.Configuration.ConfigurationProperty : string * Type * obj -> System.Configuration.ConfigurationProperty
Public Sub New (name As String, type As Type, defaultValue As Object)
Public Sub New (name As String, type As Type, default_value As Object)
Parameters
- name
- String
The name of the configuration entity.
- type
- Type
The type of the configuration entity.
- defaultValuedefault_value
- 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
- ElementInformation
- ConfigurationElementCollection
- ConfigurationElementCollectionType
- ConfigurationElement
- ConfigurationPropertyCollection
- ConfigurationSection
Applies to
ConfigurationProperty(String, Type, Object, ConfigurationPropertyOptions)
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(System::String ^ name, Type ^ type, System::Object ^ default_value, System::Configuration::ConfigurationPropertyOptions flags);
public ConfigurationProperty (string name, Type type, object defaultValue, System.Configuration.ConfigurationPropertyOptions options);
public ConfigurationProperty (string name, Type type, object default_value, System.Configuration.ConfigurationPropertyOptions flags);
new System.Configuration.ConfigurationProperty : string * Type * obj * System.Configuration.ConfigurationPropertyOptions -> System.Configuration.ConfigurationProperty
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)
Public Sub New (name As String, type As Type, default_value As Object, flags As ConfigurationPropertyOptions)
Parameters
- name
- String
The name of the configuration entity.
- type
- Type
The type of the configuration entity.
- defaultValuedefault_value
- Object
The default value of the configuration entity.
- optionsflags
- 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
- ElementInformation
- ConfigurationElementCollection
- ConfigurationElementCollectionType
- ConfigurationElement
- ConfigurationPropertyCollection
- ConfigurationSection
Applies to
ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions)
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(System::String ^ name, Type ^ type, System::Object ^ default_value, System::ComponentModel::TypeConverter ^ converter, System::Configuration::ConfigurationValidatorBase ^ validation, System::Configuration::ConfigurationPropertyOptions flags);
public ConfigurationProperty (string name, Type type, object defaultValue, System.ComponentModel.TypeConverter typeConverter, System.Configuration.ConfigurationValidatorBase validator, System.Configuration.ConfigurationPropertyOptions options);
public ConfigurationProperty (string name, Type type, object default_value, System.ComponentModel.TypeConverter converter, System.Configuration.ConfigurationValidatorBase validation, System.Configuration.ConfigurationPropertyOptions flags);
new System.Configuration.ConfigurationProperty : string * Type * obj * System.ComponentModel.TypeConverter * System.Configuration.ConfigurationValidatorBase * System.Configuration.ConfigurationPropertyOptions -> System.Configuration.ConfigurationProperty
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)
Public Sub New (name As String, type As Type, default_value As Object, converter As TypeConverter, validation As ConfigurationValidatorBase, flags As ConfigurationPropertyOptions)
Parameters
- name
- String
The name of the configuration entity.
- type
- Type
The type of the configuration entity.
- defaultValuedefault_value
- Object
The default value of the configuration entity.
- typeConverterconverter
- TypeConverter
The type of the converter to apply.
- validatorvalidation
- ConfigurationValidatorBase
The validator to use.
- optionsflags
- 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
- ElementInformation
- ConfigurationElementCollection
- ConfigurationElementCollectionType
- ConfigurationElement
- ConfigurationPropertyCollection
- ConfigurationSection
Applies to
ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions, String)
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(System::String ^ name, Type ^ type, System::Object ^ default_value, System::ComponentModel::TypeConverter ^ converter, System::Configuration::ConfigurationValidatorBase ^ validation, System::Configuration::ConfigurationPropertyOptions flags, 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);
public ConfigurationProperty (string name, Type type, object default_value, System.ComponentModel.TypeConverter converter, System.Configuration.ConfigurationValidatorBase validation, System.Configuration.ConfigurationPropertyOptions flags, string description);
new System.Configuration.ConfigurationProperty : string * Type * obj * System.ComponentModel.TypeConverter * System.Configuration.ConfigurationValidatorBase * System.Configuration.ConfigurationPropertyOptions * string -> System.Configuration.ConfigurationProperty
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)
Public Sub New (name As String, type As Type, default_value As Object, converter As TypeConverter, validation As ConfigurationValidatorBase, flags As ConfigurationPropertyOptions, description As String)
Parameters
- name
- String
The name of the configuration entity.
- type
- Type
The type of the configuration entity.
- defaultValuedefault_value
- Object
The default value of the configuration entity.
- typeConverterconverter
- TypeConverter
The type of the converter to apply.
- validatorvalidation
- ConfigurationValidatorBase
The validator to use.
- optionsflags
- 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
- ElementInformation
- ConfigurationElementCollection
- ConfigurationElementCollectionType
- ConfigurationElement
- ConfigurationPropertyCollection
- ConfigurationSection