ConfigurationSection 类

定义

表示应用程序配置值的一节。Represents a section of application configuration values.

public ref class ConfigurationSection : Microsoft::Extensions::Configuration::IConfigurationSection
public class ConfigurationSection : Microsoft.Extensions.Configuration.IConfigurationSection
type ConfigurationSection = class
    interface IConfigurationSection
    interface IConfiguration
type ConfigurationSection = class
    interface IConfiguration
    interface IConfigurationSection
Public Class ConfigurationSection
Implements IConfigurationSection
继承
ConfigurationSection
实现

构造函数

ConfigurationSection(ConfigurationRoot, String)

初始化一个新实例。Initializes a new instance.

ConfigurationSection(IConfigurationRoot, String)

初始化一个新实例。Initializes a new instance.

属性

Item[String]

获取或设置与配置键相对应的值。Gets or sets the value corresponding to a configuration key.

Key

获取此节在其父级中占用的键。Gets the key this section occupies in its parent.

Path

IConfigurationRoot 获取此节的完整路径。Gets the full path to this section from the IConfigurationRoot.

Value

获取或设置节值。Gets or sets the section value.

方法

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetChildren()

获取直接后代配置子节。Gets the immediate descendant configuration sub-sections.

GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetReloadToken()

返回一个可用于在重载此配置时进行观察的 IChangeTokenReturns a IChangeToken that can be used to observe when this configuration is reloaded.

GetSection(String)

获取具有指定键的配置子节。Gets a configuration sub-section with the specified key.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

扩展方法

Bind(IConfiguration, Object)

尝试通过按递归方式根据配置键匹配属性名称,将给定的对象实例绑定到配置值。Attempts to bind the given object instance to configuration values by matching property names against configuration keys recursively.

Bind(IConfiguration, Object, Action<BinderOptions>)

尝试通过按递归方式根据配置键匹配属性名称,将给定的对象实例绑定到配置值。Attempts to bind the given object instance to configuration values by matching property names against configuration keys recursively.

Bind(IConfiguration, String, Object)

尝试通过按递归方式根据配置键匹配属性名称,将给定的对象实例绑定到该键指定的配置节。Attempts to bind the given object instance to the configuration section specified by the key by matching property names against configuration keys recursively.

Get(IConfiguration, Type)

尝试将配置实例绑定到类型为 T 的新实例。如果此配置节包含一个值,则将使用该值。Attempts to bind the configuration instance to a new instance of type T. If this configuration section has a value, that will be used. 否则,通过按递归方式根据配置键匹配属性名称来进行绑定。Otherwise binding by matching property names against configuration keys recursively.

Get(IConfiguration, Type, Action<BinderOptions>)

尝试将配置实例绑定到类型为 T 的新实例。如果此配置节包含一个值,则将使用该值。Attempts to bind the configuration instance to a new instance of type T. If this configuration section has a value, that will be used. 否则,通过按递归方式根据配置键匹配属性名称来进行绑定。Otherwise binding by matching property names against configuration keys recursively.

Get<T>(IConfiguration)

尝试将配置实例绑定到类型为 T 的新实例。如果此配置节包含一个值,则将使用该值。Attempts to bind the configuration instance to a new instance of type T. If this configuration section has a value, that will be used. 否则,通过按递归方式根据配置键匹配属性名称来进行绑定。Otherwise binding by matching property names against configuration keys recursively.

Get<T>(IConfiguration, Action<BinderOptions>)

尝试将配置实例绑定到类型为 T 的新实例。如果此配置节包含一个值,则将使用该值。Attempts to bind the configuration instance to a new instance of type T. If this configuration section has a value, that will be used. 否则,通过按递归方式根据配置键匹配属性名称来进行绑定。Otherwise binding by matching property names against configuration keys recursively.

GetValue(IConfiguration, Type, String)

提取具有指定键的值,并将其转换为指定的类型。Extracts the value with the specified key and converts it to the specified type.

GetValue(IConfiguration, Type, String, Object)

提取具有指定键的值,并将其转换为指定的类型。Extracts the value with the specified key and converts it to the specified type.

GetValue<T>(IConfiguration, String)

提取具有指定键的值,并将其转换为 T 类型。Extracts the value with the specified key and converts it to type T.

GetValue<T>(IConfiguration, String, T)

提取具有指定键的值,并将其转换为 T 类型。Extracts the value with the specified key and converts it to type T.

AsEnumerable(IConfiguration)

获取 IConfiguration 中的键值对的枚举Get the enumeration of key value pairs within the IConfiguration

AsEnumerable(IConfiguration, Boolean)

获取 IConfiguration 中的键值对的枚举Get the enumeration of key value pairs within the IConfiguration

Exists(IConfigurationSection)

确定该部分是否具有 Value 或子级。Determines whether the section has a Value or has children.

GetConnectionString(IConfiguration, String)

GetSection("ConnectionStrings")[name] 的简写形式。Shorthand for GetSection("ConnectionStrings")[name].

适用于