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

What are multibyte characters?

0 Answers  


What do you mean by dynamic memory allocation in c?

0 Answers  


How can we allocate array or structure bigger than 64kb?

2 Answers   CSC,


to find out the reverse digit of a given number

6 Answers   Infosys, Microsoft, TCS, Wipro,


Give a fast way to multiply a number by 7

15 Answers   Accenture, Aricent, Microsoft,






Why we use conio h in c?

0 Answers  


i want to have a program to read a string and print the frequency of each character and it should work in turbo c

3 Answers   Persistent, Wipro,


In a byte, what is the maximum decimal number that you can accommodate?

0 Answers  


how to introdu5ce my self in serco

0 Answers  


Explain how can you tell whether two strings are the same?

0 Answers  


When can you use a pointer with a function?

0 Answers  


What is keyword in c?

0 Answers  


Categories