静态方法怎样访问非静态方法?

error CS0120: An object reference is required for the non-static field, method, or property xxx

静态方法不能直接使用本类的非静态方法

解决方式有三种
1、两个方法都改成非晶态
2、两个方法都改成静态
3、先创建类的实例,然后静态方法在调用这个实例的非静态方法


为什么静态成员不能访问非静态成员
http://blog.csdn.net/ningxuezhu/article/details/7489280

原文地址:https://www.cnblogs.com/bluestorm/p/3272928.html