Welcome

首页 / 网页编程 / ASP.NET / asp.net 中静态方法和动态方法调用的区别实例分析

复制代码 代码如下:
//定义静态方法
class SQLHelper  
    {
        public static string aaa()
        {
            return “你好"      
        }
    }

调用:
SQLHelper.aaa(); // 类名.方法名

//定义动态方法
class SQLHelper  
    {
        public string aaa()
        {
            return “你好"      
        }
    }
调用:
SQLHelper  s =new SQLHelper ();
s.aaa();