Answers for "how to call a class with ihostingenvironment parameter"

0

how to call a class with ihostingenvironment parameter

public class FileReader
{
    private readonly IHostingEnvironment env;
    public FileReader(IHostingEnvironment env)
    {
        if(env==null)
            throw new ArgumentNullException(nameof(env));

        this.env = env;
    }

    public string ReadFile(string fileName)
    {
       var filename = Path.Combine(env.WebRootPath, fileName);
    }
}
Posted by: Guest on March-29-2021

Code answers related to "how to call a class with ihostingenvironment parameter"

Browse Popular Code Answers by Language