D
D
Deerenaros2014-07-04 14:07:17
.NET
Deerenaros, 2014-07-04 14:07:17

What is the difference between dynamic vs Object in C#.NET?

Actually, what if we use object instead of dynamic , because dynamic does not calculate the type, but only says that it can be any. As well as object, in general. Or is it due to some magic on structs and primitives?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aush, 2014-07-04
@Deerenaros

The difference is that for dynamic you can write

dynamic myDinamic = GetDynamic();
myDynamic.SomeMethod();

Object must be cast to the type for which SomeMethod() is defined, or use reflection. Those. verification is carried over from compile time to run time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question