最初の列がキーになり、2 番目の列が値になるディクショナリとして格納される 2 つの列で構成されるファイルがあります。2 番目の列は、任意の数のスペースまたはタブである空白で区切られます。
Split() 関数を使用してこれを Dictionary に保存するにはどうすればよいですか?
recipesFile = new StreamReader(recipesRes.Stream);
char[] splitChars = {'\t', ' '};
while (recipesFile.Peek() > 0)
{
string recipesLine = "";
recipesLine = recipesFile.ReadLine();
string[] recipesInLine = recipesLine.Split(splitChars);
recipes.Add(recipesInLine[0], recipesInLine[1]);
}
ありがとう