相关疑难解决方法(0)

使用Newtonsoft Json.Net反序列化为IEnumerable类

我有一个项目,目前正在使用Json.Net为Json反序列化类,如下所示:

public class Foo {
    public Guid FooGuid { get; set; }
    public string Name { get; set; }
    public List<Bar> Bars { get; set; }
}

public class Bar {
    public Guid BarGuid { get; set; }
    public string Description { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

到目前为止它工作正常.

为了使迭代更简单,我创建了Foo类实现IEnumerable<Bar>:

public class Foo : IEnumerable<Bar> {
    public Guid FooGuid { get; set; }
    public string Name { get; set; }
    public List<Bar> Bars { get; set; }

    public …
Run Code Online (Sandbox Code Playgroud)

.net c# ienumerable json.net xamarin.ios

20
推荐指数
1
解决办法
2万
查看次数

标签 统计

.net ×1

c# ×1

ienumerable ×1

json.net ×1

xamarin.ios ×1