Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在protobuf C中序列化没有基类的类#_C#_Serialization_Protobuf Net_Base Class - Fatal编程技术网

C# 如何在protobuf C中序列化没有基类的类#

C# 如何在protobuf C中序列化没有基类的类#,c#,serialization,protobuf-net,base-class,C#,Serialization,Protobuf Net,Base Class,我有一个扩展DictionaryBase类的类。 使用protobuf序列化此类时,请给出以下异常: Repeated data (a list, collection, etc) has inbuilt behaviour and cannot be subclassed 这是我的代码: [protoContract] public class myClass :DictionaryBase { [protomember(1)] public int temp {get; s

我有一个扩展DictionaryBase类的类。 使用protobuf序列化此类时,请给出以下异常:

Repeated data (a list, collection, etc) has inbuilt behaviour and cannot be subclassed
这是我的代码:

[protoContract]
public class myClass :DictionaryBase
{
    [protomember(1)]
    public int temp {get; set;}
}
DictionaryBase类位于系统中。Collenctions


如何不能序列化基类?

IgnoreListHandling=true
添加到
[ProtoContract]
中。然而!这意味着它将忽略字典内容,而只序列化
temp
。与protobuf-net类似,类型可以是集合,也可以是叶;决不能两者兼而有之