从DLL调用函数? [英] Call function from DLL?

查看:139
本文介绍了从DLL调用函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的C#和我想学习的DLL的使用。我想换一个DLL我的对象,然后在我的程序中使用它。

 公共类Foo //其在DLL 
{
公众诠释身份证;
公共无效酒吧()
{
SomeMethodInMyProgram();
}
}



所以我尝试收拾这一个DLL,但我不能,因为编译器不知道SomeMethodInMyProgram()是。



我想用它喜欢的:

 类节目/ /我的程序,使用DLL 
{
静态无效的主要(字串[] args)
{
美孚测试=新的Foo();
test.Bar();
}
}


解决方案

添加通过Solution Explorer中的DLL - 右键点击引用 - >添加引用,然后浏览你DLL - 那么它应该是可用的。


I'm new to C# and I'm trying to learn to usage of DLLs. I'm trying to wrap my objects in a DLL, and then use it in my program.

public class Foo   // its in the DLL
{
   public int ID;
   public void Bar()
   {
      SomeMethodInMyProgram();
   } 
}

So I try to pack this to a DLL but I can't, because compiler doesn't know what the SomeMethodInMyProgram() is.

I would like to use it like:

class Program // my program, using DLL
{
    static void Main(string[] args)
    {
       Foo test = new Foo();
       test.Bar();
    }
 } 

解决方案

Add the DLL via the solution explorer - right click on references --> add reference then "Browse" to you DLL - then it should be available.

这篇关于从DLL调用函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆