how to call a class with ihostingenvironment parameter code example
Example: 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);
}
}