From what I have learned so far, there is no index
in foreach loops. So, can anyone tell me what is this index field, when inspecing object in visual studio?
Clearly, it is not index as it would be in for loop, because that number is higher than collection count.
Here is the code, I am inspecing group
variable.
static string LookAndSay (string input) {
var groups = new Regex("([0-9])\\1*").Matches(input);
var result = String.Empty;
foreach (var group in groups)
result += String.Concat(group.ToString().Length, group.ToString()[0]);
return result;
}