Call GetType method on Static Class in C# #128
-
Hello, Why can't we call GetType() method on static classes? We knew all classes in C# inherited from Object and Object has GetType method.
|
Beta Was this translation helpful? Give feedback.
Answered by
christiannagel
Sep 2, 2022
Replies: 1 comment
-
Because GetType is an instance method (not a static method) specified with the Object base class. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ShervanN
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because GetType is an instance method (not a static method) specified with the Object base class.
You can use typeof(My) instead.