Answers for "c# list any"

C#
1

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.
Posted by: Guest on November-08-2020

C# Answers by Framework

Browse Popular Code Answers by Language