What is the difference between TypeOf and GetType?

Answer Posted / avinash reddy r

typeOf is based on a class

Ex: Console.WriteLine(typeof(int))
O/P: System.Int32


GetType is based on a object

string s="Hello World"

Ex: Console.WriteLine(s.GetType())

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is inheritance possible in c sharp?

714


Can we have 2 main methods in c#?

563


What is generic delegate in c#?

531


What is indexer c#?

556


what is a static constructor?

757






What is a copy constructor in c#?

588


What is difference between float and integer?

642


Which class does the remote object has to inherit?

704


What is difference between sleep () and wait ()?

573


What is the difference between virtual method and abstract method?

622


Why do we need indexers in c#?

567


Define the term immutable ?

717


What's c# ?

665


What is dictionary class in c#?

560


Define c# delegate?

620