作者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/m.aspx?n=bbs/Programming/M.1420560363.A.150.html
1F:→ jamod: 感謝分享!有時間會來好好瀏覽一下 60.249.2.10 01/07 09:03