现在我有两个类allmethods.cs
和caller.cs
。
allmethods.cs
类中有一些方法。我想在caller.cs
中编写代码,以便调用allmethods
类中的某个方法。
代码示例:
public class allmethods
public static void Method1()
{
// Method1
}
public static void Method2()
{
// Method2
}
class caller
{
public static void Main(string[] args)
{
// I want to write a code here to call Method2 for example from allmethods Class
}
}
我该如何实现这个目标?
using static
指令。请查看我的更新答案。 - p.s.w.g