我的JSON文件内容如下:
{
01: "One",
02: "Two",
03: "Three",
04: "Four",
05: "Five",
06: "Six",
07: "Seven",
08: "Eight",
09: "Nine",
10: "Ten"
}
我正在使用Newtonsoft.Json图书馆。我这样尝试过:
var json = File.ReadAllText(@"numbers.json");
var array = JObject.Parse(json);
lookUpEdit1.Properties.DropDownRows = array.Count > 10 ? 10 : array.Count;
lookUpEdit1.Properties.DisplayMember = "Key";
lookUpEdit1.Properties.ValueMember = "Value";
lookUpEdit1.Properties.DataSource = array.ToList();
lookUpEdit1.Properties.Columns.Add(new LookUpColumnInfo("Key"));
它给出了这样的错误: 'JObject' does not contain a definition for 'ToList' and no extension method 'ToList' accepting a first argument of type 'JObject' could be found (are you missing a using directive or an assembly reference?)
如何从JSON文件填写Devexpress Winforms LookUpEdit?
相关分类