第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

反序列化接口實例的集合?

反序列化接口實例的集合?

吃雞游戲 2019-08-27 18:07:36
反序列化接口實例的集合?我想通過json.net序列化這段代碼:public interface ITestInterface{     string Guid {get;set;}}public class TestClassThatImplementsTestInterface1{     public string Guid { get;set; }}public class TestClassThatImplementsTestInterface2{     public string Guid { get;set; }}public class ClassToSerializeViaJson{     public ClassToSerializeViaJson()     {                       this.CollectionToSerialize = new List<ITestInterface>();          this.CollectionToSerialize.add( new TestClassThatImplementsTestInterface2() );          this.CollectionToSerialize.add( new TestClassThatImplementsTestInterface2() );     }     List<ITestInterface> CollectionToSerialize { get;set; }}我想用json.net序列化/反序列化ClassToSerializeViaJson。序列化工作正常,但反序列化給了我這個錯誤:Newtonsoft.Json.JsonSerializationException:無法創(chuàng)建ITestInterface類型的實例。Type是接口或抽象類,無法實例化。那么我該如何反序列化List<ITestInterface>集合呢?
查看完整描述

3 回答

  • 3 回答
  • 0 關注
  • 567 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號