我有一堂课
public class A
{
public A(IB b)
{
}
public void Method1()
{
}
}
Run Code Online (Sandbox Code Playgroud)
class Program
{
static void Main(string[] args)
{
var serviceProvider = new ServiceCollection()
.AddSingleton<IB,B>()
.BuildServiceProvider();
//How to call Method1 of classA
classA a = new classA();
}
}
Run Code Online (Sandbox Code Playgroud)
如何Method1()从Main方法调用?
我收到一个编译时错误,因为“不存在重载方法”。