我是C#的新手,我正在學習如何使用DLL。我試圖將我的對象包裝在一個DLL中,然後在我的程序中使用它。從DLL調用函數?
public class Foo // its in the DLL
{
public int ID;
public void Bar()
{
SomeMethodInMyProgram();
}
}
所以我嘗試收拾這一個DLL,但我不能,因爲編譯器不知道是什麼SomeMethodInMyProgram()是。
我想用它喜歡:
class Program // my program, using DLL
{
static void Main(string[] args)
{
Foo test = new Foo();
test.Bar();
}
}
在這方面,C#與C \ C++完全不同。 .NET運行時可以從.dll中提取足夠的信息來確定方法簽名是什麼(在C#中沒有頭文件) – Jimmy 2011-02-16 00:10:03
啊,那麼。呃......繼續 – thecoshman 2011-02-16 00:17:47