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

Answer Posted / nidhi

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 ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how can you check to see whether a symbol is defined?

633


What is the argument of a function in c?

547


i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....

1492


What is assignment operator?

603


What are the different types of C instructions?

621






How is null defined in c?

629


Why do we use int main?

575


How can I read in an object file and jump to locations in it?

547


Explain pointers in c programming?

605


What is the purpose of 'register' keyword?

661


Explain what is the benefit of using an enum rather than a #define constant?

689


What are the complete rules for header file searching?

638


Can we access array using pointer in c language?

621


Can you define which header file to include at compile time?

561


How do you override a defined macro?

663