好吧,所以首先我已经在项目中设置了我正在使用dll的引用.我想要做的是访问我的utils dll中的方法"haha"
dll的代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Utils
{
public class kb
{
public class yes {
public void haha(string yes)
{
int test = Convert.ToInt32(yes);
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
在我试图访问哈哈的项目我只有"Utils.kb.yes",但没有方法...我所能做的就是Utils.kb.yes.equals和Utils.kb.yes.ReferenceEquals.
由于haha()是实例方法,您需要首先创建Utils.kb.yes该类的实例:
Utils.kb.yes kb = new Utils.kb.yes();
kb.haha("nextproblem");
Run Code Online (Sandbox Code Playgroud)
或者你也可以使方法静态:
public class yes {
public static void haha(string yes)
{
int test = Convert.ToInt32(yes);
}
}
Run Code Online (Sandbox Code Playgroud)
然后你可以这样称呼它:
Utils.kb.yes.haha("I am static!");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
53 次 |
| 最近记录: |