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

What are structure members?

584


What is indirection in c?

609


How can I invoke another program or command and trap its output?

600


printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions

620


i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none

631






What are the usage of pointer in c?

690


Explain continue keyword in c

568


What is wrong with this program statement? void = 10;

791


Can a pointer be volatile in c?

518


Can we assign integer value to char in c?

605


What are Macros? What are its advantages and disadvantages?

627


Tell me the use of bit field in c language?

612


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

564


How does sizeof know array size?

605


What does return 1 means in c?

573