相关疑难解决方法(0)

异步protobuf序列化

protobuf-net实现的一个限制是它同步调用底层流.通过不提供异步API,例如BeginSerialize/EndSerialize或TPL等价物,我们被迫绑定一个等待同步流I/O的线程.

有没有计划在protobuf-net中提供异步方法,或者有任何创造性的方法来解决这个问题?

.net c# protobuf-net

7
推荐指数
1
解决办法
2282
查看次数

C#部分反序列化

所以我有一个xml,它具有与此类似的结构:

<MyObject>
    <PropertyA>Value</PropertyA>
    <PropertyB>Value</PropertyB>
    <PropertyC>Value</PropertyC>
    <ArrayOfOtherObject>
        <OtherObject>
            <PropertyX>Value</PropertyX>
            <PropertyY>Value</PropertyY>
            <PropertyZ>Value</PropertyZ>
        </OtherObject>
        <OtherObject>
            <PropertyX>Value</PropertyX>
            <PropertyY>Value</PropertyY>
            <PropertyZ>Value</PropertyZ>
        </OtherObject>
        <OtherObject>
            <PropertyX>Value</PropertyX>
            <PropertyY>Value</PropertyY>
            <PropertyZ>Value</PropertyZ>
        </OtherObject>
    </ArrayOfOtherObject>
</MyObject>
Run Code Online (Sandbox Code Playgroud)

有没有办法可以反序列化MyObject而不是ArrayOfOtherObject?然后在需要时做一个懒惰的ArrayOfOtherObject加载?

我通常使用XmlDeserialization,但AFAIK总是加载整个东西.

谢谢!

c# serialization

6
推荐指数
1
解决办法
2032
查看次数

标签 统计

c# ×2

.net ×1

protobuf-net ×1

serialization ×1