Search Results for

    Show / Hide Table of Contents

    Method GetEnv

    | Improve this Doc View Source

    GetEnv(String)

    Gets the value of an environment variable from the current process.

    Declaration
    public static string GetEnv(this string variable)
    Parameters
    Type Name Description
    String variable

    The name of the environment variable.

    Returns
    Type Description
    String

    The value of the environment variable.

    Exceptions
    Type Condition
    ArgumentNullException

    variable is null.

    VariableNotSetException

    variable is not set in current process.

    | Improve this Doc View Source

    GetEnv<TConversionType>(String)

    Gets the value of an environment variable in a specific format.

    Declaration
    public static TConversionType GetEnv<TConversionType>(this string variable)
        where TConversionType : IConvertible
    Parameters
    Type Name Description
    String variable

    The name of the environment variable.

    Returns
    Type Description
    TConversionType

    An value whose type is TConversionType.

    Type Parameters
    Name Description
    TConversionType

    The type of object to return.

    Exceptions
    Type Condition
    ArgumentNullException

    variable is null.

    VariableNotSetException

    variable is not set in current process.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright ©2021 DotEnv.Core