Net Dynamics Question: Download Net Dynamics PDF

Explain the difference between dynamic and var data types?

Tweet Share WhatsApp

Answer:

The difference between the var and dynamic data types is that the var data type is strongly type checked at the compile time; whereas, the dynamic data type is type checked by the compiler only at run time. After declaring a var data type, you cannot explicitly change its type throughout the execution of the program; however, a variable of the dynamic data type can be changed during runtime. Another major difference between the two is that dynamic type can also be used as the return type for methods, for which var cannot be used.

Download Net Dynamics PDF Read All 21 Net Dynamics Questions
Previous QuestionNext Question
What is ExpandoObject?What is DynamicObject?