how to call static method inside non static method in c#

前端 未结 4 913
隐瞒了意图╮
隐瞒了意图╮ 2021-01-24 05:58

how to call static method inside non static method in c# ?

Interviewer gave me scenario :

class class1
{

    pub         


        
4条回答
  •  无人及你
    2021-01-24 06:56

    class1.method1();
    

    Same as you'd call any other static method

    Apparently (as Selman22 pointed out) - the classname isn't necessary.

    So

    method1();
    

    would work just as well

提交回复
热议问题