作者AmosYang (泛用人型编码器)
看板Programming
标题Re: [问题] C#的一个List和Array的问题
时间Wed Jan 7 00:05:57 2015
※ 引述《littleshan (我正在想要换什麽)》之铭言:
: ※ 引述《jamod (jasper)》之铭言:
: : 应该是有关记忆体的问题,但上网找了一些说明,还是不是很了解
: 如果你研究过 C++ 的 l-value / r-value / reference
: 再看到这个现象会比较容易理解
: C# 稍微牺牲了一点弹性
: 但加强了记忆体的安全 (不会有 dangling reference)
补充几个讨论串
*
http://stackoverflow.com/questions/441309/why-are-mutable-structs-evil
*
http://stackoverflow.com/questions/6339602/why-doesnt-c-sharp-support-the-return-of-references
*
http://stackoverflow.com/questions/3284767/can-i-use-a-reference-inside-a-c-sharp-function-like-c/
*
http://ericlippert.com/2011/06/23/ref-returns-and-ref-locals/
讲到 C# 语言实务经验, Eric Lippert 的 blog 不只是值得一读
,而且是绝对不能错过的重要资料
(如果能问出让 Eric Lippert 乱入来回答的问题,就有如在格斗
游戏中满足了让豪鬼乱入的条件,是踏入 C#/.NET/CLR 八奇思
考领域的第一步 :D )
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 68.4.199.75
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/Programming/M.1420560363.A.150.html
1F:→ jamod: 感谢分享!有时间会来好好浏览一下 60.249.2.10 01/07 09:03