How to get number of items in a List with C#
The Count property gets the total actual number of items in list.
The following code snippet display number of items in a list.
// Create a list of stringsList<string> AuthorList = new List<string>();AuthorList.Add("Mahesh Chand");AuthorList.Add("Praveen Kumar");AuthorList.Add("Raj Kumar");AuthorList.Add("Nipun Tomar");AuthorList.Add("Dinesh Beniwal");
// CountConsole.WriteLine("Count: {0}", AuthorList.Count);
Download Free book: Programming List with C#
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: