0

I am new to c# I have one question, In java we can execute static blocks of a class without creating any object by using Class.forName("ClassName"), Like this can we execute static constructor in c# without creating actual object. I am providing the code in Java,pls Can any one achieve the same functionality in c#?

import java.util.*;
import java.lang.*;

class MyClass
{  
    public static void main(String args[])throws ClassNotFoundException
    {
       Class.forName("Student");
    }
}

class Student
{
    static 
    {
        System.out.println("static");
    }

}
karun
  • 91
  • 1
  • 11

0 Answers0