Unity C# 程式 教學 情場教戰手冊 (Array + List + Foreach)
陳間時光
程式碼下載 http://www.morningfungame.com/2016/12/Unity-Csharp-beginner-array-list-foreach.html
本心得分享系列絕非正統教學,但自我期許是趣味影片,倘若各路高手發現內容有誤,煩請不吝指教以矯正視聽,感謝
參考資料: http://stackoverflow.com/questions/434761/array-versus-listt-when-to-use-which
Use an array when you are dealing with data that is: 處理這種資料的時候就使用array陣列:
fixed in size, or unlikely to grow much 固定長度, 或不太可能加長(的資料)
suitably large (more than 10, 50, 100 elements, depending on the algorithm) 適合大量資料(超過10,50,100個元素,取決於演算法) ( 陳間時光 註:array的效率比較快)
you will be doing lots of indexing into it, i.e. you know you will often want the third element, or the fifth, or whatever. 你將會大量地依據索引值去存取它,比方你知道你會常常需要第三個元素, 或是第五個,或其他任何元素
Use a list for: 使用List清單:
variable length data lists 可伸縮長度的資料清單
when you do not want to write an expression to derive the ultimate array size for the declaration and you do not want to wastefully pick a large number
當你不想在宣告array陣列的時候就確定長度 而且不想很浪費地設成一個超長的大陣列的時候
============== 其他參考資料 http://cs0.wikidot.com/datastructure http://py3939.pixnet.net/blog/post/28297262-%5Bc%23-note%5Dlist- http://www.appledaily.com.tw/appledaily/article/headline/20150514/36549901/
圖片來源 http://www.freepik.com/free-photo/blank-notebook-with-pink-cover_859176.htm http://www.freepik.com/free-vector/open-flat-notebook-with-bookmarks_895271.htm
請作者喝飲料 http://www.morningfungame.com/p/blog-page_3.html
部落格 http://www.morningfungame.com
粉絲頁 https://www.facebook.com/morningfungame/
讚的圖片來源 Designed by Kreativkolors / Freepik
片尾底圖來源 Designed by Freepik http://www.freepik.com/free-vector/background-for-summer-vacation_774013.htm
http://www.freepik.com/free-vector/coloured-arrows-collection_876806.htm 你還想看到哪些教學? https://goo.gl/forms/F4XvvobXdp5nz3Bp1 ... https://www.youtube.com/watch?v=EOnWTaN472g
62095566 Bytes