反序列化“;序列化Protobuf”;在objective-c中,使用c#protobuf网络生成

反序列化“;序列化Protobuf”;在objective-c中,使用c#protobuf网络生成,c#,c++,objective-c,.net,protocol-buffers,C#,C++,Objective C,.net,Protocol Buffers,我有一个包含对象、数组、int和字符串的类 public class Template { [ProtoMember(1)] public string name; [ProtoMember(2)] public tempClass contour; [ProtoMember(3)] . . . } //And here is the Serializin

我有一个包含对象、数组、int和字符串的类

public class Template
    {
        [ProtoMember(1)]
        public string name;
        [ProtoMember(2)]
        public tempClass contour;
        [ProtoMember(3)]
        .
        .
        .
  }

//And here is the Serializing code (Using protobuf-net)
 using (var file = File.Create("Templates.bin"))
            {
                Serializer.Serialize<Template[]>(file, tempArray);
            }
公共类模板
{
[原成员(1)]
公共字符串名称;
[原成员(2)]
公众阶级轮廓;
[原成员(3)]
.
.
.
}
//下面是序列化代码(使用protobuf net)
使用(var file=file.Create(“Templates.bin”))
{
Serializer.Serialize(文件,tempArray);
}
我知道它可以使用Objective-c进行反序列化。我尝试了一些解决办法,但还没有成功

以前有人这样做过吗?使用XML而不是Protobuf更好吗?

将映射到(以.proto术语):

消息模板包装器{
重复模板项=1;
}
消息模板{
可选字符串名称=1;
可选tempClass等高线=2;
// ...
}
消息临时类{
// ...
}
然后反序列化为单个
templateWrapper
,其中将包含多个


请注意,除了
templateWrapper
之外的所有.proto架构都应该可以通过
Serializer.GetProto()

获得更多详细信息!如何创建“.proto”?那是什么?@HazemAbdullah.proto是许多protobuf实现使用的模式定义语言;对于任何给定的实现,通常都有一个工具(“protoc”、“protogen”或类似的东西),它接受text.proto文件作为输入,输出平台/语言/库特定的文件作为输出;您可以参考以查找所选应用程序的实现platform@HazemAbdullah有一个objc示例-查找
protoc
@HazemAbdullah以了解“如何创建”.proto'?”-或者:手工编写,或者(如上所述)使用
Serializer.GetProto()