1.首先自定义一个Json文件
[
{
"Id": 3,
"Name": "天下无贼",
"Damage": 123
},
{
"Id": 4,
"Name": "空格",
"Damage": 150
},
{
"Id": 5,
"Name": "流星",
"Damage": 200
}
]
2.再自定义一个类
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyJson
{
class Skill
{
public int Id;
public string Name;
public int Damage;
public override string ToString()
{
return string.Format("id:{0} name:{1} damage{2}",Id,Name,Damage);
}
}
}
3.开始解析Json文件的三种方