static bool IsInclusive(char ch) { switch (ch) { case '[': case ']': return true; case '{': case '}': return false; default: throw new ArgumentException("Could not understand range boundary char " + ch + "."); } }