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

What is difference between struct and class in c#?

465


Why ref is used in c#?

466


Is c# an open source?

492


Give 2 scenarios where static constructors can be used?

485


What is static and use of it?

465






what is IFormatable

576


What is arraylist?

538


What is streamreader/streamwriter class?

511


Why are mutable structs evil?

538


In the page load event I assigned dropdownlist’s datasource property to a valid list. On the submit button click.. The same datasource property is coming as null. Why?

456


What is difference between abstract class and interface in c#?

470


Can a sealed class be used as a base class?

527


What is interpolation in programming?

486


Can I use exceptions in c#?

537


Is c# or c++ better for games?

462