ConfigurationProperty Konstruktorer
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Initierar en ny instans av ConfigurationProperty klassen.
Överlagringar
| Name | Description |
|---|---|
| ConfigurationProperty(String, Type) |
Detta API stöder produktinfrastrukturen och är inte avsett att användas direkt från koden. Initierar en ny instans av ConfigurationProperty klassen. |
| ConfigurationProperty(String, Type, Object) |
Detta API stöder produktinfrastrukturen och är inte avsett att användas direkt från koden. Initierar en ny instans av ConfigurationProperty klassen. |
| ConfigurationProperty(String, Type, Object, ConfigurationPropertyOptions) |
Detta API stöder produktinfrastrukturen och är inte avsett att användas direkt från koden. Initierar en ny instans av ConfigurationProperty klassen. |
| ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions) |
Detta API stöder produktinfrastrukturen och är inte avsett att användas direkt från koden. Initierar en ny instans av ConfigurationProperty klassen. |
| ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions, String) |
Detta API stöder produktinfrastrukturen och är inte avsett att användas direkt från koden. Initierar en ny instans av ConfigurationProperty klassen. |
ConfigurationProperty(String, Type)
Initierar en ny instans av ConfigurationProperty klassen.
Detta API stöder produktinfrastrukturen och är inte avsett att användas direkt från koden.
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)
Parametrar
- name
- String
Namnet på konfigurationsentiteten.
- type
- Type
Typen av konfigurationsentitet.
Gäller för
ConfigurationProperty(String, Type, Object)
Initierar en ny instans av ConfigurationProperty klassen.
Detta API stöder produktinfrastrukturen och är inte avsett att användas direkt från koden.
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)
Parametrar
- name
- String
Namnet på konfigurationsentiteten.
- type
- Type
Typen av konfigurationsentitet.
- defaultValue
- Object
Standardvärdet för konfigurationsentiteten.
Exempel
Följande kodexempel visar hur du använder ConfigurationProperty.ConfigurationProperty(String, Type, Object) konstruktorn för att instansiera ett konfigurationsegenskapsobjekt.
// Initialize the _FileName property
_FileName =
new ConfigurationProperty("fileName",
typeof(string), "default.txt");
' Initialize the _FileName property
_FileName = New ConfigurationProperty( _
"fileName", GetType(String), "default.txt")
Kommentarer
När du instansierar ett ConfigurationProperty objekt med den här konstruktorn IsRequired anges egenskaperna och IsKey till false. Dessutom fungerar inte en instans som görs med den här konstruktorn som standardegenskap för samlingsnyckel.
Se även
- ElementInformation
- ConfigurationElementCollection
- ConfigurationElementCollectionType
- ConfigurationElement
- ConfigurationPropertyCollection
- ConfigurationSection
Gäller för
ConfigurationProperty(String, Type, Object, ConfigurationPropertyOptions)
Initierar en ny instans av ConfigurationProperty klassen.
Detta API stöder produktinfrastrukturen och är inte avsett att användas direkt från koden.
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)
Parametrar
- name
- String
Namnet på konfigurationsentiteten.
- type
- Type
Typen av konfigurationsentitet.
- defaultValue
- Object
Standardvärdet för konfigurationsentiteten.
- options
- ConfigurationPropertyOptions
Ett av uppräkningsvärdena ConfigurationPropertyOptions .
Exempel
Följande kodexempel visar hur du använder ConfigurationProperty.ConfigurationProperty(String, Type, Object, ConfigurationPropertyOptions) konstruktorn för att instansiera ett konfigurationsegenskapsobjekt.
// 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)
Se även
- ElementInformation
- ConfigurationElementCollection
- ConfigurationElementCollectionType
- ConfigurationElement
- ConfigurationPropertyCollection
- ConfigurationSection
Gäller för
ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions)
Initierar en ny instans av ConfigurationProperty klassen.
Detta API stöder produktinfrastrukturen och är inte avsett att användas direkt från koden.
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)
Parametrar
- name
- String
Namnet på konfigurationsentiteten.
- type
- Type
Typen av konfigurationsentitet.
- defaultValue
- Object
Standardvärdet för konfigurationsentiteten.
- typeConverter
- TypeConverter
Vilken typ av konverterare som ska tillämpas.
- validator
- ConfigurationValidatorBase
Den validator som ska användas.
- options
- ConfigurationPropertyOptions
Ett av uppräkningsvärdena ConfigurationPropertyOptions .
Exempel
I följande kodexempel visas vilken typ av parametrar som ska användas när konstruktorn anropas ConfigurationProperty.ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions) .
// 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.]")
Se även
- ElementInformation
- ConfigurationElementCollection
- ConfigurationElementCollectionType
- ConfigurationElement
- ConfigurationPropertyCollection
- ConfigurationSection
Gäller för
ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions, String)
Initierar en ny instans av ConfigurationProperty klassen.
Detta API stöder produktinfrastrukturen och är inte avsett att användas direkt från koden.
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)
Parametrar
- name
- String
Namnet på konfigurationsentiteten.
- type
- Type
Typen av konfigurationsentitet.
- defaultValue
- Object
Standardvärdet för konfigurationsentiteten.
- typeConverter
- TypeConverter
Vilken typ av konverterare som ska tillämpas.
- validator
- ConfigurationValidatorBase
Den validator som ska användas.
- options
- ConfigurationPropertyOptions
Ett av uppräkningsvärdena ConfigurationPropertyOptions .
- description
- String
Beskrivningen av konfigurationsentiteten.
Exempel
Följande kodexempel visar hur du använder ConfigurationProperty.ConfigurationProperty(String, Type, Object, TypeConverter, ConfigurationValidatorBase, ConfigurationPropertyOptions, String) konstruktorn för att instansiera ett konfigurationsegenskapsobjekt.
// 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.]")
Se även
- ElementInformation
- ConfigurationElementCollection
- ConfigurationElementCollectionType
- ConfigurationElement
- ConfigurationPropertyCollection
- ConfigurationSection