List定义 不能写入,但可以read

具体参考下面这个stackoverflow的答案

How can I add to List data structures?

You can't (without unsafe casts). You can only read from them.

The problem is that you don't know what exactly the list is a list of. It could be a list of any subclass of Number, so when you try to put an element into it, you don't know that the element actually fits into the list.

For example the List might be a list of Bytes, so it would be an error to put a Float into it.

版权声明:
作者:dingding
链接:https://www.techfm.club/p/86807.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>