0

I have been searching around the internet for a few questions I have on the List<T> class with no success.
1. how do you edit the last item in your list
2. how do you edit a specific items value, every time i do it says you cannot edit a return value. i simply do this list[item].x = 2;
3. how do you iterate through a list, with out using foreach because i need to edit the iterating variable
4. this is part of the 1st question and the 3rd but what is a lists equivalent to an arrays length property.

thank you for any help you provide

Edited by noey699: n/a

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by noey699
0

1) list[list.Count-1]
2) Is x a public property or is it a method? More info on your implementation, please.
3) for (int i = 0; i < list.Count; i++)
4) I think you know by now.

Edited by apegram: n/a

0

nvm on number 2, i was using a struct and changed to a class and it worked. I am a C++ programmer learning C#. Ty though that really helped.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.