tyoeof()
typeof is used to get the type based on a class. It
takes class as parameter. If you pass object as parameter it throws an error.
object s = "Hello"; Type t = typeof(object); Console.WriteLine(t); Output: System.object
GetType()
GetType is used to get the type based
on an object (an instance of a class).It takes object as parameter.
object s = "Hello"; Type t = typeof(object); Console.WriteLine(t); Output: System.object
0 comments:
Post a Comment