Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class Microsoft.​Extensions.​Configuration.​ConfigurationExtensions
Assembly: Microsoft.Extensions.Configuration.Abstractions
Inheritance: object → ConfigurationExtensions
Provides extension methods for configuration classes.
Methods
public static
IConfigurationBuilder
Add​(IConfigurationBuilder builder,
System.​Action?<​TSource> configureSource)
Adds a new configuration source.
Returns The <see cref="T:Microsoft.Extensions.Configuration.IConfigurationBuilder" /> .
builder
The builder to add to.
configureSource
Configures the source secrets.
public static
System.​Collections.​Generic.​IEnumerable<​System.​Collections.​Generic.​KeyValuePair<​string, string>>
AsEnumerable​(IConfiguration configuration)
Get the enumeration of key value pairs within the <see cref="T:Microsoft.Extensions.Configuration.IConfiguration" />
Returns An enumeration of key value pairs.
configuration
The configuration to enumerate.
public static
System.​Collections.​Generic.​IEnumerable<​System.​Collections.​Generic.​KeyValuePair<​string, string>>
AsEnumerable​(IConfiguration configuration,
bool makePathsRelative)
Get the enumeration of key value pairs within the <see cref="T:Microsoft.Extensions.Configuration.IConfiguration" />
Returns An enumeration of key value pairs.
configuration
The configuration to enumerate.
makePathsRelative
<see langword="true" /> to trim the current configuration's path from the front of the returned child keys.
public static
bool
Exists​(IConfigurationSection section)
Determines whether the section has a <see cref="P:Microsoft.Extensions.Configuration.IConfigurationSection.Value" /> or has children.
Returns <see langword="true" /> if the section has values or children; otherwise, <see langword="false" /> .
section
The section to enumerate.
public static
string
GetConnectionString​(IConfiguration configuration,
string name)
Gets the specified connection string from the specified configuration.
Shorthand for <c>GetSection("ConnectionStrings")[name]</c> .
Returns The connection string.
configuration
The configuration to enumerate.
name
The connection string key.
public static
IConfigurationSection
GetRequiredSection​(IConfiguration configuration,
string key)
Gets a configuration subsection with the specified key.
Returns The <see cref="T:Microsoft.Extensions.Configuration.IConfigurationSection" /> .
configuration
The configuration to enumerate.
key
The key of the configuration section.
Remarks
If no matching sub-section is found with the specified key, an exception is raised.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object