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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / 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

More C Interview Questions

How we can write a value to an address using macro..?

0 Answers   Tata Elxsi,


what is the syallabus of computer science students in group- 1?

0 Answers  


Find if a number is power of two or not?

1 Answers  


Why is c platform dependent?

0 Answers  


a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.

0 Answers  






WHAT IS HEADER?

8 Answers   ProKarma, TCS,


What is a constant and types of constants in c?

0 Answers  


Differentiate between declaring a variable and defining a variable?

0 Answers  


How can I read a directory in a c program?

1 Answers   CSC,


What is the difference between realloc() and free()

1 Answers  


wat are the two methods for swapping two numbers without using temp variable??

2 Answers  


what is the difference between auto and static keywords

1 Answers   cDot, College School Exams Tests, TCS,


Categories