Month.txt
ファイルの内容のみを実行すると、これはforeach
の文字列として設定されているためですが、他の文字を追加する方法についてはうまくいかないこのファイルも同様に、月だけでなくすべてのファイルの内容を取得できますか?foreach複数の配列を読み取る
string[] month = System.IO.File.ReadAllLines
(@"E:\project1\input\Month.txt");
string[] 1_AF = System.IO.File.ReadAllLines
(@"E:\project1\input\1_AF.txt");
string[] 1_Rain = System.IO.File.ReadAllLines
(@"E:\project1\input\1_Rain.txt");
string[] 1_Sun = System.IO.File.ReadAllLines
(@"E:\project1\input\1_Sun.txt");
string[] 1_TBig = System.IO.File.ReadAllLines
(@"E:\project1\input\1_TBig.txt");
string[] 1_TSmall = System.IO.File.ReadAllLines
(@"E:\project1\input\1_TSmall.txt");
System.Console.WriteLine("Contents of all files =:");
foreach (string months in month)
{
Console.WriteLine(months + "\t" + 1_AF + "\t" + 1_Rain + "\t" + 1_Sun + "\t" + 1_TBig + "\t" + 1_TSmall);
}
Console.ReadKey();
あなたは、あなたは、配列 –
あなたが 'List'、' Dictionary'、または 'Tuple'を使用して考えがありますのためのforeachを適用することができ、配列のリストを作成し、そのリストに個々のファイルのコンテンツを追加する必要がありますか?彼らはあなたのような場合に非常に便利です。 – Ian