Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I find out the count of how many classlist there are?


C#
public class Class1
{
    public Int32 id { get; set; }
    public string col1 { get; set; }
    public string col2 { get; set; }
    public string col3 { get; set; }
}


C#
List<Class1> classlist = new List<Class1>();
classlist.Add(new Class1() { id = 1, col1 = "11", col2 = "22", col3="33" });
classlist.Add(new Class1() { id = 2,  col1 = "44", col2 = "55", col3="66" });
classlist.Add(new Class1() { id = 3,  col1 = "77", col2 = "88", col3="99" });
Posted

try

classlist.Count

this should work
 
Share this answer
 
There's only one instance of classlist.  That instance contains classlist.Count items.

/ravi
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900