c# - creating a list and then converting it to array -


arrays fast can not add array on other hand lists handy can add new items without worrying slower first use lists add items , convert array mylist.toarray() , process data array. i'm wondering effective speed wise? or i'm wasting more time converting array?

msdn says toarray o(n) n count: https://msdn.microsoft.com/en-us/library/x303t819%28v=vs.110%29.aspx

the elements copied using array.copy, o(n) operation, n count.

this method o(n) operation, n count.

therefore you're going process list twice: once toarray call , again in next loop process list. removing toarray more performant doing conversion in cases.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -