
上QQ阅读APP看书,第一时间看更新
Importing datasets
The following is how we our datasets:
public static List<DataSet>ImportDatasets()
{
var dialog = new OpenFileDialog
{
Multiselect = false,
Title = "Open Dataset File",
Filter = "Text File|*.txt;"
};
using (dialog)
{
if (dialog.ShowDialog() != DialogResult.OK)
return null;
using (var file = File.OpenText(dialog.FileName))
{
Deserialize the data and return it:
return JsonConvert.DeserializeObject<List<DataSet>>(file.ReadToEnd());
}
}
}