C# 静态方法调用实例方法

 

public class TestStatic
{
public int Add(int a, int b)
{
return a + b;
}

public static int MyAdd(int a, int b)
{
int result = new TestStatic().Add(a, b);
return result;
}

}

//调用

static void Main(string[] args)
{
Console.WriteLine(TestStatic.MyAdd(1,3));
Console.ReadLine();
}

 

posted @ 2021-08-21 00:11  atkfc  阅读(482)  评论(0编辑  收藏  举报