Answers for "list object c# any method"

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
3

to list c#

var arr = new int[] {1, 2, 3};
List<int> list = arr.ToList();
Posted by: Guest on June-17-2020

C# Answers by Framework

Browse Popular Code Answers by Language