How can i identify specific item in collection


#1

To code “Item(2).ToString” was invalid but how can i identify third item in collection?


#2

What type of collection you are using? Can you elaborate


#3

Thanks for comment.
I’m using a type “System.Collection.Generic.ICollection<System.Dtring>”


#4

for such type of collection you can use this, standalone or in a loop -

image

Hope this helps !


#5

Thanks, I could understand how to output these items, but actually want to identify and output only “value2” like item(1).ToString.
Can I only output specified item in “Collection”?


#6

of course in for each loop you can have a if condition what matches to your requirement so you will be getting filtered data then


#7

Just use ‘item(1)’ instead of ‘item(1).ToString’. Since it’s a collection of String no need to add .ToString


#8

It was my easy miss-understanding.
I should code collection(1).ToString but did like
item(1).ToString
Sorry for bothering you guys…


#9

No problem @ryoryo, I hope that solved your problem