When you declare a Reference Type, it is null ... until you initialize it.
So when you declare: List<string> s; // 's is null
And, when you intialize 's: s = new List<string>(); // 's is not null, internal List has #0 elements.
You can check for both the case of 'null and internal List having #0 elements like this:
if (s == null || s.Count == 0)
{
errorText = "error";
}
else
{
}
This code takes advantage of the fact that at run-time .NET will evaluate the first logical term in an 'if statement OR test and return 'true if it evaluates to 'true
without evaluating the second term of the OR test.
If you tried to access the Count Property of 's when it was declared, but not initialized, that would cause an error.
However, if you are certain you have initialized 's, then you can just use (s.Count == 0) for your test expression.