我有以下内容:
- 一个名为 GlobalStrings 的主要列表
- 另一个名为 localStrings 的列表
例如,在循环中:
List<string> GlobalStrings = new List<string>();
List<string> localStrings = new List<string>();
for(x=1;x<10;x++)
{
localStrings.Add("some value");
localStrings.Add("some value");
}
// Want to append localStrings to GlobalStrings as easily as possible
localStrings = new List<string>;
应该放在for
循环之前。 - Wassim AZIRARfor (int x = 0; x < 10; ++x) {var localStrings = GetAListOfStrings(); /* 将它们附加到GlobalStrings */}
- Jim Balter