最佳答案
public class Bar
{
public static readonly string Foo = ConfigurationManager.AppSettings["Foo"];
}
In the .NET Framework 4.x, I can use the ConfigurationManager.AppSettings ["Foo"] to get Foo in Webconfig,and then I can easily get the value of Foo through Bar.Foo
But in .Net core, I mustto inject options, And can not get the value of Foothrough Bar.Foo
Is there a method, which can be directly through the Bar.Foo to get the value of Foo?