Monday, 24 August 2015

Difference Between var and dynamic in c#

var Keyword :
==================

1.Introduced with c# 3.0
2.It is type safe.Compiler knows the type of it at compile time
3. Intellisense is available
4.Useful when you don't know type of it.

Dynamic Keyword :
===================

1.Introduced with c# 4.0 on the top of dynamic language runtime.
2.It is not type safe,you will only get to know type of it at runtime.
3.Intellisense is not available.
4.Useful when you use things like office   interop or something return from the   dynamic language              like ironruby.

No comments:

Post a Comment