Show / Hide Table of Contents

Class ConfigurationExtensionMethods

Inheritance
object
ConfigurationExtensionMethods
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Benday.Common
Assembly: Benday.Common.dll
Syntax
public static class ConfigurationExtensionMethods

Methods

| Edit this page View Source

GetStringThrowIfNullOrEmpty(IConfiguration, string)

This method retrieves a value from the configuration and returns it as a string. If the key does not exist or the value is null or empty, it throws an exception.

Declaration
public static string GetStringThrowIfNullOrEmpty(this IConfiguration config, string key)
Parameters
Type Name Description
IConfiguration config
string key
Returns
Type Description
string
| Edit this page View Source

SafeGetString(IConfiguration, string, string)

This method retrieves a value from the configuration and returns it as a string. If the key does not exist or the value is null, it returns the default value.

Declaration
public static string SafeGetString(this IConfiguration config, string key, string defaultValue = "")
Parameters
Type Name Description
IConfiguration config
string key
string defaultValue
Returns
Type Description
string
  • Edit this page
  • View Source
In this article
Back to top Copyright © www.benday.com | info@benday.com