计算C#中的字符串列表 [英] Count List of String in C#

查看:123
本文介绍了计算C#中的字符串列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



i有一个字符串列表。

i就像这样,



Hello all,

i have a list of string.
i make it like this,

List<string> V = New List<string>();





i混淆计算该列表(V)。

有人可以帮我解决我的问题吗?



i confuse to count that list(V).
may someone help me to solve my problem?

推荐答案

其他人都给了你这个问题的答案,Count属性会告诉你List和lt中有多少元素;吨取代。他们没有告诉你的是,通过阅读列表与LT; T>课程 [ ^ ]并了解它。如果您不了解Count属性,那么有关该类的更多信息,您也不知道并且可能需要。
Everyone else has given you the answer to the question, the Count property will tell you how many elements are in the List<t>. What they DIDN'T tell you is that you would be far better served by reading the documentation on the List<t> class[^] and learning about it. If you didn't know about the Count property, there's a ton more information about that class you also don't know about and probably going to need.


List< string> V = new List< string>();



V.Add(Count 1);

V.Add(Count 2);

V.Add(Count 3);

V.Add(Count 4);



V.Count();
List<string> V = new List<string>();

V.Add("Count 1");
V.Add("Count 2");
V.Add("Count 3");
V.Add("Count 4");

V.Count();


V.Count给出了列表大小的数量。



u可以使用单个像V [1] .count来计算索引中的所有字符串1





例如:



V.Count gives the amount of the list size.

u can use a single like V[1].count, to count all strings inside the index 1


example:

List<string> V = new List<string>();
V.Count();


这篇关于计算C#中的字符串列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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