In C#, given the array :
string[] myStrings = new string[] { \"test#test\", \"##test\", \"######\", // Winner (outputs 6) };
How can
You can do that with Linq combined to Regex:
Linq
Regex
myStrings.Select(x => Regex.Matches(x, "#").Count).max();