Previous solutions, which everyone here suggests, queryValues2 consists of strings with at least one character in them. Although this is true for example code, this is not always always true.
Suppose you have this:
string[] queryValues2 = new string[5] { "A", "b", "c", "", null };
(what could be if the array of strings is transmitted by the caller, for example).
A solution that goes directly to qRes[0] will raise IndexOutOfRangeException by "" and a NullReferenceException by null .
Therefore, a safer alternative for the general case would be the following:
where !string.IsNullOrEmpty(qRes) && char.IsUpper(qRes[0])
source share