如何在c#中反序列化匿名对象

时间:2014-07-15 14:47:32

标签: c# serialization deserialization

我将一些序列化数据放入CheckBoxList中的项目值

chkList.Items.Add(new ListItem(item.title, JsonConvert.SerializeObject(new { ME_ID = item.id, ME_Start = Convert.ToDateTime(item.start), ME_End = Convert.ToDateTime(item.end) })));

现在用户选择了我需要将值读回对象的项目

List<string> selectedValues = chkList.Items.Cast<ListItem>()
            .Where(li => li.Selected)
            .Select(li => li.Value)
            .ToList();

        foreach (string item in selectedValues) { 
            //what to write here?
        }

我怎样才能将字符串读入对象?也许我需要创建一个强类型?

0 个答案:

没有答案