Monday, 5 February 2018

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

Powered by Blogger.

Followers

Translate

Currency Converter

Exchange Rate

Featured post

Interpolation in angular 5

When we want to communicate from component class to template ,we can use interpolation which use the { { expression }} to render the bound...

Popular Posts

My Facebook Page