What is the difference between typeof(foo) and myFoo.GetType()?

Answer Posted / enso

Operator typeof(foo) is used to obtain the System.Type
object for a type at compile time.

myFoo.GetType() is used to obtain the exact run time type of
an object. This method uses reflection.

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I get a null pointer in my programs?

621


What is the process of writing the null pointer?

607


How can I get the current date or time of day in a c program?

653


List some applications of c programming language?

553


What are the advantages of Macro over function?

1207






Why should I prototype a function?

643


What are the disadvantages of a shell structure?

696


How many data structures are there in c?

619


Why does notstrcat(string, "!");Work?

644


Explain what are global variables and explain how do you declare them?

644


string reverse using recursion

1813


What is spaghetti programming?

671


Why can’t constant values be used to define an array’s initial size?

837


Describe static function with its usage?

613


Why do we use & in c?

593