Why use dynamic typing in c#?

后端 未结 6 2252
旧时难觅i
旧时难觅i 2020-12-17 23:53

At first I thought something like:

var aName=getAllSomethings();

Is very unreadable, and so I\'ll use dynamic typing just when there\'s

6条回答
  •  既然无缘
    2020-12-18 00:18

    This is not dynamic typing. The var declares a static type known at compile time and it will be absolutely equivalent to declaring the type name. The compiler will infer the type and replace it in the resulting assembly.

提交回复
热议问题