Ich habe folgendes:anhängen Listen Inhalt auf eine andere Liste C#
- Eine Hauptliste genannt GlobalStrings
- Eine weitere Liste genannt localStrings
In einer Schleife zum Beispiel:
GlobalStrings = new List<string>();
for(x=1;x<10;x++)
{
localStrings = new List<string>;
localStrings.Add("some value");
localStrings.Add("some value");
// Want to append localStrings to GlobalStrings as easily as possible
}
Stapel über Fluss immer rockt. ..nice question ... –
Sie tun es falsch, 'localStrings = neue Liste;' sollte vor dem 'for' Klo platziert werden p –
Wassim, ich denke, deshalb unterscheidet er zwischen lokal und global; localStrings ist lokal für den for-loop-Bereich, GlobalStrings ist im globalen Bereich. – Dagrooms