例如,我的项目中有一个课程,
namespace BrightCompany.BigProjects.MyBigProject.ApplicationCodeFolder
{
public class MyBigProjectsClass
{
public static string returnStringMethod()
{
return "Your a Star";
}
}
}
现在在另一个类中,我想使用此方法,
namespace BrightCompany.BigProjects.MyBigProject
{
public class MyBigProjectsClassABC
{
private void ABC()
{
string tooLong = BrightCompany.BigProjects.MyBigProject.ApplicationCodeFolder.MyBigProjectsClass.returnStringMethod();
}
}
}
我要如何简短地说,我试着把这个,
using BrightCompany.BigProjects.MyBigProject.ApplicationCodeFolder;
但是没有收获,只有痛苦!
最佳答案
这是语法:
using MyAlias = BrightCompany.BigProjects.MyBigProject.ApplicationCodeFolder;
不过,以下操作也可以:
using BrightCompany.BigProjects.MyBigProject.ApplicationCodeFolder;
namespace BrightCompany.BigProjects.MyBigProject
{
public class MyBigProjectsClassABC
{
private void ABC()
{
string tooLong = MyBigProjectsClass.returnStringMethod();
}
}
}