c# linq any & element at code example
Example: 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.