Why use dynamic typing in c#?

后端 未结 6 2261
旧时难觅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:14

    That isn't dynamic typing. Dynamic typing is through the "dynamic" type (oddly enough). Using var has no overhead at all, it is a coding shorthand that still produces strongly typed variables.

提交回复
热议问题