在一个名为Security的类中,有一个方法:
    public static bool HasAccess(string UserId, string ModuleID)
如何调用此方法,以便返回bool结果?
我尝试了跟进但没有成功:
    Security security = new Security();
    bool result = security.HasAccess("JKolk","Accounting");
bool result = Security.HasAccess("JKolk","Accounting");
要调用静态方法,您不需要实例化调用它的对象.
http://msdn.microsoft.com/en-us/library/79b3xss3.aspx
请注意,您可以混合使用静态和非静态成员,例如:
public class Foo
{
    public static bool Bar() { return true; }
    public bool Baz() { return true; }
    public static int X = 0;
    public int Y = 1;
}
Foo f = new Foo();
f.Y = 10; // changes the instance
f.Baz(); // must instantiate to call instance method
Foo.X = 10; // Important: other consumers of Foo within the same AppDomain will see this value
Foo.Bar(); // call static methods without instantiating the type