list object c# any method code example
Example 1: to list c#
var arr = new int[] {1, 2, 3};
List<int> list = arr.ToList();
Example 2: 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.