1
Reply

What is the difference between typeof() and GetType()?

18y
12.2k
0
Reply

    // Obtain type information from a variable.
    SomeType c = new SomeType();
    Type t = c.GetType();
    INeedYourTypeInfo(t);

    // Obtain type information via typeof.
    INeedYourTypeInfo(typeof(SomeType));