When you need to iterate over a hardcoded, ad-hoc/temporary (only used in the foreach) list of strings, what's a best practice or a better coding standard: using a List<string>
or string[]
? It's not an array vs List question, but a very specific code situation.
Example:
foreach (var item in new List<string>() {"A", "B", "C", ..., "Z"}) { ... }
vs
foreach (var item in new []{"A", "B", "C", ... "Z"}) { ... }