C#清单订单持续性 [英] C# List Order Persistance

查看:97
本文介绍了C#清单订单持续性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果未执行Sort方法,System.Collections.Generic.List是否将始终按其添加项的顺序保留其项目的索引?

谢谢.

If no Sort methods are performed, will a System.Collections.Generic.List always keep its item''s indexes in the order they were added?

Thanks.

推荐答案

是的.首先,如果没有的话,那将是无用的.第二,没有理由不这样做.当然,这是假设您始终添加到末尾,并且永远不要在中间的某处插入项目.但是,除非明确移动,否则它们的放置顺序就是它们的停留顺序.
Yes. In the first instance, it would be useless if it didn''t. In the second, there''s no reason for it not to. Of course, that''s assuming you always add to the end, and never insert an item in the middle somewhere. But, the order they are placed in, is the order they stay in unless explicitly moved.


这篇关于C#清单订单持续性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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