r/shittyprogramming • • Apr 15 '19

this good code? Is

Post image
308 Upvotes

51 comments sorted by

View all comments

Show parent comment

-4

u/AyrA_ch Apr 15 '19

The class just stores 4 plugins it's always 4 of the same types so why use a dynamic array with LINQ?

If it's always 4 and always of the same type, why not actually store them in the order you want to load them?

That would just makes it slower and harder to read.

You are iterating over an array once to load plugins, whatever mechanism the loader triggers is going to dwarf the time this Linq query does to the 4 entries.

Linq is also not that hard to read. You can't really get more verbose than OrderByDescending(o=>o.ThisKey) to order a list. It's almost identical to SQL (that syntax is also supported in LINQ)