how to call static method?

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Hi,

I have an aspx file and it's cs file. I have another class
cs file which execute stored procedure.

In the class cs file, there are static methods.

But, the button event method in aspx.cs file is not static
type.

How can i use that static method in aspx.cs which is non-
static?
 
You just call the method, using the class name in place of the instance
name:

public class MyClass
{
public static void StaticDoit() { }
public void Doit() { }
}

// instance:
MyClass mc = new MyClass();
mc.Doit();

// static:
MyClass.StaticDoIt();

Richard
 
Back
Top