我正在使用如图所示声明的对象。“选择”元素的顺序是否有所不同?
DataCollection<Entity> collection = GetDataCollection(...);
然后,我挑选出两组数据,如下所示。
IEnumerable<String>
array_1 = collection.Select(
element => element.Attributes["attribute_1"] as String),
array_2 = collection.Select(
element => element.Attributes["attribute_2"] as String);
我非常好奇,如果这两个数组保证有相同的顺序。即如果他们的单独订单必须与原始序列中的相同。或者,至少,如果订单因任何原因而改变,第一个单独列表中的i
th元素是否仍然对应于另一个元素中的i
th元素?
是安全的,在一次'变种ARR = collection.Select(元件同时获得ATTRS =>新的{ \t \t \t \t \t \t ATTR1 = element.Attributes [ “ATT1”]作为字符串, \t \t \t \t \t \t ATTR2 = element.Attributes [ “ATT2”]作为字符串 \t \t \t \t \t});' –