//复制构造函数 public ItemListClass(ItemListClass anotherItemListClass) { datetime = anotherItemListClass.datetime; cardID = anotherItemListClass.cardID; money = anotherItemListClass.money; type = anotherItemListClass.type; description = anotherItemListClass.description; }
//从Json到一个ItemListClass构成的List public bool JsonToItemListClass(string jstr) { listViewItems = new List<ItemListClass>(); JsonReader reader = new JsonTextReader(new StringReader(jstr)); while (reader.Read()) { //Console.WriteLine(reader.ValueType + "\t\t" + reader.Value); if (reader.Value.Equals("ItemListClass")) //读入一个个ItemListClass { reader.Read(); ItemListClass item = new ItemListClass(); item = (ItemListClass)reader.Value; } } return true; }