Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

ConfigurationBinder.GetValue Method

Definition

Namespace:
Microsoft.Extensions.Configuration
Assembly:
Microsoft.Extensions.Configuration.Binder.dll
Package:
Microsoft.Extensions.Configuration.Binder v11.0.0-preview.5.26302.115

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.

Overloads

Name Description
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)

Extracts the value with the specified key and converts it to type T.

GetValue<T>(IConfiguration, String, T)

Extracts the value with the specified key and converts it to type T.

GetValue(IConfiguration, Type, String)

Source:
ConfigurationBinder.cs
Source:
ConfigurationBinder.cs
Source:
ConfigurationBinder.cs
Source:
ConfigurationBinder.cs

Extracts the value with the specified key and converts it to the specified type.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ GetValue(Microsoft::Extensions::Configuration::IConfiguration ^ configuration, Type ^ type, System::String ^ key);
[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? GetValue(this Microsoft.Extensions.Configuration.IConfiguration configuration, Type type, string key);
public static object? GetValue(this Microsoft.Extensions.Configuration.IConfiguration configuration, Type type, string key);
[<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 GetValue : Microsoft.Extensions.Configuration.IConfiguration * Type * string -> obj
static member GetValue : Microsoft.Extensions.Configuration.IConfiguration * Type * string -> obj
<Extension()>
Public Function GetValue (configuration As IConfiguration, type As Type, key As String) As Object

Parameters

configuration
IConfiguration

The configuration.

type
Type

The type to convert the value to.

key
String

The key of the configuration section's value to convert.

Returns

The converted value.

Attributes

Applies to

GetValue(IConfiguration, Type, String, Object)

Source:
ConfigurationBinder.cs
Source:
ConfigurationBinder.cs
Source:
ConfigurationBinder.cs
Source:
ConfigurationBinder.cs

Extracts the value with the specified key and converts it to the specified type.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ GetValue(Microsoft::Extensions::Configuration::IConfiguration ^ configuration, Type ^ type, System::String ^ key, System::Object ^ defaultValue);
[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? GetValue(this Microsoft.Extensions.Configuration.IConfiguration configuration, Type type, string key, object? defaultValue);
public static object? GetValue(this Microsoft.Extensions.Configuration.IConfiguration configuration, Type type, string key, object? defaultValue);
[<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 GetValue : Microsoft.Extensions.Configuration.IConfiguration * Type * string * obj -> obj
static member GetValue : Microsoft.Extensions.Configuration.IConfiguration * Type * string * obj -> obj
<Extension()>
Public Function GetValue (configuration As IConfiguration, type As Type, key As String, defaultValue As Object) As Object

Parameters

configuration
IConfiguration

The configuration.

type
Type

The type to convert the value to.

key
String

The key of the configuration section's value to convert.

defaultValue
Object

The default value to use if no value is found.

Returns

The converted value.

Attributes

Applies to

GetValue<T>(IConfiguration, String)

Source:
ConfigurationBinder.cs
Source:
ConfigurationBinder.cs
Source:
ConfigurationBinder.cs
Source:
ConfigurationBinder.cs

Extracts the value with the specified key and converts it to type T.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static T GetValue(Microsoft::Extensions::Configuration::IConfiguration ^ configuration, System::String ^ key);
[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? GetValue<T>(this Microsoft.Extensions.Configuration.IConfiguration configuration, string key);
public static T? GetValue<T>(this Microsoft.Extensions.Configuration.IConfiguration configuration, string key);
[<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 GetValue : Microsoft.Extensions.Configuration.IConfiguration * string -> 'T
static member GetValue : Microsoft.Extensions.Configuration.IConfiguration * string -> 'T
<Extension()>
Public Function GetValue(Of T) (configuration As IConfiguration, key As String) As T

Type Parameters

T

The type to convert the value to.

Parameters

configuration
IConfiguration

The configuration.

key
String

The key of the configuration section's value to convert.

Returns

T

The converted value.

Attributes

Applies to

GetValue<T>(IConfiguration, String, T)

Source:
ConfigurationBinder.cs
Source:
ConfigurationBinder.cs
Source:
ConfigurationBinder.cs
Source:
ConfigurationBinder.cs

Extracts the value with the specified key and converts it to type T.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static T GetValue(Microsoft::Extensions::Configuration::IConfiguration ^ configuration, System::String ^ key, T defaultValue);
[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? GetValue<T>(this Microsoft.Extensions.Configuration.IConfiguration configuration, string key, T defaultValue);
public static T? GetValue<T>(this Microsoft.Extensions.Configuration.IConfiguration configuration, string key, T defaultValue);
[<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 GetValue : Microsoft.Extensions.Configuration.IConfiguration * string * 'T -> 'T
static member GetValue : Microsoft.Extensions.Configuration.IConfiguration * string * 'T -> 'T
<Extension()>
Public Function GetValue(Of T) (configuration As IConfiguration, key As String, defaultValue As T) As T

Type Parameters

T

The type to convert the value to.

Parameters

configuration
IConfiguration

The configuration.

key
String

The key of the configuration section's value to convert.

defaultValue
T

The default value to use if no value is found.

Returns

T

The converted value.

Attributes

Applies to


Feedback

Was this page helpful?