我如何找出有多少列表的数量 [英] How do I find out the count of how many classlist there are

查看:90
本文介绍了我如何找出有多少列表的数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何找出有多少班级列表的数量?





How do I find out the count of how many classlist there are?


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







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" });

推荐答案

尝试



classlist.Count



这应该可行
try

classlist.Count

this should work


只有一个 classlist 的实例。 该实例包含 classlist.Count 项目。



/ ravi
There's only one instance of classlist.  That instance contains classlist.Count items.

/ravi


这篇关于我如何找出有多少列表的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆