C#怎样将一个txt文件按标记行拆分生成

2024-11-29 13:27:42
推荐回答(1个)
回答1:

using System;
using System.Collections.Specialized;
using System.IO;

var lines = File.ReadAllLines("1.txt");
var dict = new StringDictionary();
string[] arr;
int idx;
foreach(var line in lines){
arr = line.Split(':');

dict.Add(arr[0],arr[1]);
}