語言

ConfigurationBinder.Get 方法

定義

多載

名稱 Description
Get(IConfiguration, Type)

嘗試將配置實例綁定到新的 T 型實例。如果這個配置區段有值,就會被使用。 否則,則是透過將屬性名稱與配置鍵遞迴匹配來綁定。

Get(IConfiguration, Type, Action<BinderOptions>)

嘗試將配置實例綁定到新的 T 型實例。如果這個配置區段有值,就會被使用。 否則,則是透過將屬性名稱與配置鍵遞迴匹配來綁定。

Get<T>(IConfiguration)

嘗試將配置實例綁定到新的 T 型實例。如果這個配置區段有值,就會被使用。 否則,則是透過將屬性名稱與配置鍵遞迴匹配來綁定。

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

嘗試將配置實例綁定到新的 T 型實例。如果這個配置區段有值,就會被使用。 否則,則是透過將屬性名稱與配置鍵遞迴匹配來綁定。

Get(IConfiguration, Type)

來源:
ConfigurationBinder.cs
來源:
ConfigurationBinder.cs
來源:
ConfigurationBinder.cs
來源:
ConfigurationBinder.cs

嘗試將配置實例綁定到新的 T 型實例。如果這個配置區段有值,就會被使用。 否則,則是透過將屬性名稱與配置鍵遞迴匹配來綁定。

public:
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ Get(Microsoft::Extensions::Configuration::IConfiguration ^ configuration, Type ^ type);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")]
public static object? Get(this Microsoft.Extensions.Configuration.IConfiguration configuration, Type type);
public static object? Get(this Microsoft.Extensions.Configuration.IConfiguration configuration, Type type);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")>]
static member Get : Microsoft.Extensions.Configuration.IConfiguration * Type -> obj
static member Get : Microsoft.Extensions.Configuration.IConfiguration * Type -> obj
<Extension()>
Public Function Get (configuration As IConfiguration, type As Type) As Object

參數

configuration
IConfiguration

要綁定的設定實例。

type
Type

要綁定的新實例類型。

傳回

新實例成功時,否則為 null。

屬性

適用於

Get(IConfiguration, Type, Action<BinderOptions>)

來源:
ConfigurationBinder.cs
來源:
ConfigurationBinder.cs
來源:
ConfigurationBinder.cs
來源:
ConfigurationBinder.cs

嘗試將配置實例綁定到新的 T 型實例。如果這個配置區段有值,就會被使用。 否則,則是透過將屬性名稱與配置鍵遞迴匹配來綁定。

public:
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ Get(Microsoft::Extensions::Configuration::IConfiguration ^ configuration, Type ^ type, Action<Microsoft::Extensions::Configuration::BinderOptions ^> ^ configureOptions);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")]
public static object? Get(this Microsoft.Extensions.Configuration.IConfiguration configuration, Type type, Action<Microsoft.Extensions.Configuration.BinderOptions>? configureOptions);
public static object? Get(this Microsoft.Extensions.Configuration.IConfiguration configuration, Type type, Action<Microsoft.Extensions.Configuration.BinderOptions>? configureOptions);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")>]
static member Get : Microsoft.Extensions.Configuration.IConfiguration * Type * Action<Microsoft.Extensions.Configuration.BinderOptions> -> obj
static member Get : Microsoft.Extensions.Configuration.IConfiguration * Type * Action<Microsoft.Extensions.Configuration.BinderOptions> -> obj
<Extension()>
Public Function Get (configuration As IConfiguration, type As Type, configureOptions As Action(Of BinderOptions)) As Object

參數

configuration
IConfiguration

要綁定的設定實例。

type
Type

要綁定的新實例類型。

configureOptions
Action<BinderOptions>

設定資料夾選項。

傳回

新實例成功時,否則為 null。

屬性

適用於

Get<T>(IConfiguration)

來源:
ConfigurationBinder.cs
來源:
ConfigurationBinder.cs
來源:
ConfigurationBinder.cs
來源:
ConfigurationBinder.cs

嘗試將配置實例綁定到新的 T 型實例。如果這個配置區段有值,就會被使用。 否則,則是透過將屬性名稱與配置鍵遞迴匹配來綁定。

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static T Get(Microsoft::Extensions::Configuration::IConfiguration ^ configuration);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")]
public static T? Get<T>(this Microsoft.Extensions.Configuration.IConfiguration configuration);
public static T? Get<T>(this Microsoft.Extensions.Configuration.IConfiguration configuration);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")>]
static member Get : Microsoft.Extensions.Configuration.IConfiguration -> 'T
static member Get : Microsoft.Extensions.Configuration.IConfiguration -> 'T
<Extension()>
Public Function Get(Of T) (configuration As IConfiguration) As T

類型參數

T

要綁定的新實例類型。

參數

configuration
IConfiguration

要綁定的設定實例。

傳回

T

若成功,則使用新的 T 實例,否則 default(T)。

屬性

適用於

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

來源:
ConfigurationBinder.cs
來源:
ConfigurationBinder.cs
來源:
ConfigurationBinder.cs
來源:
ConfigurationBinder.cs

嘗試將配置實例綁定到新的 T 型實例。如果這個配置區段有值,就會被使用。 否則,則是透過將屬性名稱與配置鍵遞迴匹配來綁定。

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static T Get(Microsoft::Extensions::Configuration::IConfiguration ^ configuration, Action<Microsoft::Extensions::Configuration::BinderOptions ^> ^ configureOptions);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")]
public static T? Get<T>(this Microsoft.Extensions.Configuration.IConfiguration configuration, Action<Microsoft.Extensions.Configuration.BinderOptions>? configureOptions);
public static T? Get<T>(this Microsoft.Extensions.Configuration.IConfiguration configuration, Action<Microsoft.Extensions.Configuration.BinderOptions>? configureOptions);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")>]
static member Get : Microsoft.Extensions.Configuration.IConfiguration * Action<Microsoft.Extensions.Configuration.BinderOptions> -> 'T
static member Get : Microsoft.Extensions.Configuration.IConfiguration * Action<Microsoft.Extensions.Configuration.BinderOptions> -> 'T
<Extension()>
Public Function Get(Of T) (configuration As IConfiguration, configureOptions As Action(Of BinderOptions)) As T

類型參數

T

要綁定的新實例類型。

參數

configuration
IConfiguration

要綁定的設定實例。

configureOptions
Action<BinderOptions>

設定資料夾選項。

傳回

T

若成功,則使用新的 T 實例,否則 default(T)。

屬性

適用於