当前位置: 代码迷 >> Windows Mobile >> 独立储存保存数据的时候发生错误
  详细解决方案

独立储存保存数据的时候发生错误

热度:47   发布时间:2016-04-25 07:11:59.0
独立储存保存数据的时候发生异常
“System.Runtime.Serialization.InvalidDataContractException”类型的异常在 System.Runtime.Serialization.ni.dll 中发生,但未在用户代码中进行处理

其他信息: Type 'PhoneApp2.inf' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.


这个是什么意思
------解决方案--------------------
'PhoneApp2.inf'这个怎么成了TYPE了,代码的问题吧. 
------解决方案--------------------
引用:
Quote: 引用:

'PhoneApp2.inf'这个怎么成了TYPE了,代码的问题吧. 

        private void longListSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
           var selectedItem = longListSelector.SelectedItem;
             Sto.save_inf["selected"] = selectedItem;//独立储存
             Sto.save_inf.Save();//异常发生在这里,貌似是无法序列化,不知道怎么弄
      }
  我用调试工具看的,PhoneApp2.inf是独立储存中饭selected的值

selectedItem是什么类型,它无法序列化造成的错误。
  相关解决方案