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

What is a char in c?

557


In which layer of the network datastructure format change is done

1435


Is there a way to switch on strings?

622


What is the difference between declaring a variable and defining a variable?

725


What are 'near' and 'far' pointers?

620






How can I generate floating-point random numbers?

609


What is volatile variable how do you declare it?

567


Explain how are 16- and 32-bit numbers stored?

786


 write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare.  You will then tabulate this information in another file.

1731


what is the role you expect in software industry?

1658


What is a node in c?

550


the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....

22237


How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?

1591


What do mean by network ?

660


What does the error message "DGROUP exceeds 64K" mean?

728