我想在另一个文件(类)中使用一个方法。你可以看到// first class filenamespace AutomatskI{ class Method{ public void client() { // some code }// second class filenamespace AutomatskaIA{ class AutomaticTestRun public void login() { // Here i want to use that code client(); }
1 回答
慕勒3428872
TA贡献1848条经验 获得超6个赞
您应该在第二个库中引用您的第一个库
// Reference your first library like this
using AutomatskI;
namespace AutomatskaIA
{
class AutomaticTestRun
{
public void login()
{
// Then reach this class method like this
Method method = new Method();
method.client();
// Or use a static class instead by putting a 'static' tag in class name.
// So you don't have to create an instance of this class in order
// to use its methods. Then you can do it like this:
// Method.client();
}
// ...
请在发布之前格式化您的代码,以便人们更轻松地阅读您的代码。
- 1 回答
- 0 关注
- 81 浏览
添加回答
举报
0/150
提交
取消