开发者

c# collections List class

Greetings!

I am using List class.I will define my code below.

开发者_如何学运维
List<c1> lis = new List<c1>();

where c1 is class. I want to find index of particular item in List.say in list i have, 10,20,30,40 inside List.In this how i find the index of 30.Please help me to get a solution.

Thank You Regards Jennie


Maybe this is what are you looking for? List.IndexOf Method (T)


Use:

lis.IndexOf(value)

That should return the first index of the requested value.


c1 c = new c1(); should be INSIDE the loop.

Actualy, what is your code supposed to represent? Are you aware you have Array inside a list. So in your case, you end up with List with 4 items of same instance of single object, that has array of 4 items with strings "0","1","2","3". You should fix this first before you ask your question again.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜