0
如何執行解析參數,如果是Action類型?如何使用Autofac解析Action參數
public class TaskWrapper : ITaskWrapper
{
public TaskWrapper(Action action)
{
this.action = action;
}
}
public void Connect()
{
Program.Container.Resolve<TaskWrapper>(new NamedParameter("action", ToConnect)); // not work!
Program.Container.Resolve<TaskWrapper>(new TypedParameter(typeof(Action), ToConnect)); // not work!
}
private void ToConnect()
{
// some code...
}
NamedParameter和TypedParameter不工作