I have the following class definition:
public static string SplitString(string someText)
{
var queryArray = Regex.Split(someText, "\\s+(?=\\w+)");
foreach (var i in Enumerable.Range(0, queryArray.Count - 1)) {
// Some code
}
}
The problem is that queryArray.Count is giving me the following error:
The property ‘System.Array.Count’ cannot be used in this context because the get accessor is inaccessable.
What am i missing here?
You may try the
Lengthproperty instead:Also your code would probably have been more readable if it was written like this:
or like this: