public JingJie FromJson(string json) { int from = json.IndexOf(':') + 1, end = json.IndexOf(','); if (from == 0 || end == -1) { return(this); } string typeStr = json.Substring(from, end - from).Trim(); int test = 0; if (int.TryParse(typeStr, out test)) { Type = (EnumJingJie)test; } from = json.LastIndexOf(':') + 1; end = json.LastIndexOf(')'); string gradeStr = json.Substring(from, end - from).Trim(); if (int.TryParse(gradeStr, out test)) { Grade = test; } return(this); }
public JingJie(EnumJingJie type = EnumJingJie.None, int grade = 0) { Type = type; Grade = grade; }
public JingJie(int type, int grade) { Type = (EnumJingJie)type; Grade = grade; }