Can we say var keyword is Compile time Polymorphism and Dynamic is Run Time Polymorphism?
var a=10; (Compile time Polymorphism)
dynamic a=10; (Dynamic is Run Time Polymorphism)
a="XYZ"; (Dynamic is Run Time Polymorphism)
Can we say var keyword is Compile time Polymorphism and Dynamic is Run Time Polymorphism?
var a=10; (Compile time Polymorphism)
dynamic a=10; (Dynamic is Run Time Polymorphism)
a="XYZ"; (Dynamic is Run Time Polymorphism)
I don't think you can link var and dynamic with polymorphism exactly. Polymorphism is about actions and behaviours and not data type or bindings.
var is evaluated at compile-time and dynamic is evaluated at runtime. You are correct there though.
for a better understanding look into What's the difference between dynamic (C# 4) and var?
Also, a suggestion. A little bit of reading and searching would have answered your query.
More Description
Polymorphism is about an entity that can take many forms or behave differently. As an object can be a parent class instance or a child class instance. Now var cannot take multiple types on its own. Its type is just inferred with the type of object being assigned to it. So technically var is not compile-time polymorphism. Rather it depends on the object being assigned to that.
So, var and dynamic might help you achieve or demonstrate polymorphism, but they do not themselves are examples of polymorphism.
var and dynamic have no relation whatsoever to polymorphism. Polymorphism means that you can provide an instance of a more-derived type when a less-derived type is required. var and dynamic are just syntactic sugar; the compiler does the work of figuring out what type you mean or need given the situation (in the case of dynamic). Apples and oranges.