|
-
April 17th, 2011, 07:03 PM
#1
List and order question
When using Lists, is it safe to assume that when I add an object it will always go at the end, and that the order will always be kept the same? I'm planing on using one in a way where this will be very important. Basically, objects will go in a list and be saved to disk, and be read back in the same order, if the order changes, it will mess things up.
If this is not save, is there a better collection type to use for something where order is crucial?
-
April 17th, 2011, 08:08 PM
#2
Re: List and order question
"... is it safe to assume that when I add an object it will always go at the end, ...
That would be my assumption predicated on the definition found at
http://msdn.microsoft.com/en-us/library/3wcytfd1.aspx
-
April 18th, 2011, 03:48 PM
#3
Re: List and order question
 Originally Posted by ThermoSight
Isn't MSDN cool? Quite often, you can get an answer just by checking out the class description in the docs. It's such a time saver, but yet not many people seem to make it their first stop for looking for info.
-
April 18th, 2011, 08:05 PM
#4
Re: List and order question
Often I check something there, and I make an assumption about something which in the end is partially false or there is a factor I don't know about and kicks me in the ***, so that's why I was asking.
But I'm guessing, it's safe then? There's no factors that could somehow change the order?
-
April 18th, 2011, 10:47 PM
#5
Re: List and order question
 Originally Posted by Red Squirrel
Often I check something there, and I make an assumption about something which in the end is partially false or there is a factor I don't know about and kicks me in the ***, so that's why I was asking.
But I'm guessing, it's safe then? There's no factors that could somehow change the order?
If you read through the List<T> documention, you'll find that a list item can be accessed by index. Would it make sense to access a list item by index if the order changed underneath you?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|