KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Possible Duplicate: What’s the difference between dynamic(C# 4) and var? What is the difference between dynamic and var keyword in .NET 4.0 (VS 2010). As per MSDN, the definition of dynamic is - Dynamic lookup allows you to write method, operator and indexer calls, property and field accesses, and even object invocations which bypass the normal static binding of C# and instead gets resolved dynamically . Whereas the definition for var is - An implicitly typed local variable is strongly typed just as if you had declared the type yourself, but the compiler determines the type . How is this different in the code context below: var a1 = new A(); a1.Foo(1); dynamic a2 = new A(); a2.Foo(1);
Tags (comma-separated)
Save Edits
Cancel