我想使用DLL库代码并使用我的c#代码链接/引用它。在定义var instance = new ProjectM1()时没有任何问题,引用似乎正常工作。 但是在下面的行中出现一个错误,ProjectM1不包含ProjectM1的定义,并且找不到扩展方法(可能缺少using指令或程序集引用)
namespace GanttC
{
public class ProjectM1 : ProjectM1<Task, object>
{
}
public class ProjectM1<T, R> : IProjectM1<T, R>
where T : Task
where R : class
{
public ProjectM1() (routine to call !)
{
Now = 0;
Start = DateTime.Now;
TimeScale = GanttC.TimeScale.Day;
}
}
}
现在这里是在公共类ProjectM1中调用例程ProjectM1的主要代码:
using GanttC
namespace WindowsApp2
{
public partial class Form4 : Form
{
Form2 fh;
public Form4(Form2 caller)
{
fh = caller;
InitializeComponent();
}
private void Form4_Load(object sender, EventArgs e)
{
var instance = new ProjectM1();
instance.ProjectM1(); (error !!!)
}
}
}