In C#, given the array :
string[] myStrings = new string[] { \"test#test\", \"##test\", \"######\", // Winner (outputs 6) };
How can
You can write something like this. Note the usage of DefaultIfEmpty, to not throw an exception if myStrings is empty, but revert to 0.
DefaultIfEmpty
myStrings
0
var maximum = myStrings.Select(e => e.Count(ee => ee == '#')).DefaultIfEmpty().Max();