finding the maximum length of lists in c#

Viewed 117945

After I have created a list and added the contents to it, how can I find the length of the list?

6 Answers

Example: Let we are creating a List with some string named vec. Then Add 3 string and see the size using vec.Count.

List<string> vec = new List<string>();      
vec.Add("Md.");        
vec.Add("Ahsan");          
vec.Add("Habib");           
Console.WriteLine(vec.Count);

You look to property size, then property length. But in c# its Count

myList.ToArray().Length
Related