关于静态static
1.静态方法
using System; namespace sqlcon { class statictest { private static void a() { Console.WriteLine("123"); } static void Main() { statictest.a(); Console.ReadKey(); } } }
2.静态类
using System; namespace sqlcon { static class statictest { static int q = 123456;//需设置为静态e()函数方法才能访问得到 private static void a() { int a, b, c; a = 1; b = 2; c = a + b; Console.WriteLine(c); Console.WriteLine("123"); } public static void e() { a(); Console.WriteLine(q); } static void Main() { statictest. e(); Console.ReadKey(); } } }
时间就像海绵里的水,只要你愿意挤,总还是有的——鲁迅