How can you find out that there is not a single element in the list or array?

  • 3
    List <T> has the Count property, and Length - the Alexander Muksimov
  • one
    If you are given an exhaustive answer, do not forget to tick it as true. - rdorn
  • @rdorn yes, of course - ZOOM SMASH

1 answer 1

Check the Length property of an array or Count list.

 int[] array = {1, 2, 3}; if(array.Length == 0) Console.WriteLine("Массив пуст."); var list = new List<int>(); if(list.Count == 0) Console.WriteLine("Список пуст."); 
  • one
    Thank you so much - ZOOM SMASH
  • one
    @ZOOMSMASH, please! - trydex