JK2
-1
Q:

c# list any

List<int> numbers = new List<int> { 1, 2 };
bool hasElements = numbers.Any();
string result = hasElements ? "is not" : "is";

Console.WriteLine($"The list {result} empty.");

// This code produces the following output:
// The list is not empty.
0

New to Communities?

Join the community