I want to filter an array of strings:
string[] args
from the command line, for example: "-command1 xy -command2 ab -command3 cd"
First, all words with the symbol '-', and then convert them to uppercase.
var commands = args.Where(x => x.StartsWith("-")).ToList<String>(); commands.ForEach(x => { x.ToUpper() }); commands.ToString();
This will return a list of args with words starting with a lowercase "-" - that is, lambda is not applied. Why is this? Is a copy of the list for lambda capture, and which is modified, not the Origina list itself?
source share