Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Printing count of a LIST in C#

Count property will provide the total items present in the list.

  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace forgetCode
  5. {
  6. class program
  7. {
  8. public static void Main()
  9. {
  10. List<int> list = new List<int>();
  11. list.Add(1);
  12. list.Add(2);
  13. list.Add(3);
  14. Console.WriteLine(list.Count);
  15. }
  16. }
  17. }


Output:
3