我正在计划一个应用程序,其中服务器端将用 C# 编写,客户端将使用 phonegap 创建
该应用程序大量使用使用 protobuf-net 库序列化的二进制文件。
假设我在 C# 中有一个对象
public class Foo
{
private string FooProp;
}
并且此对象被序列化并使用 phonegap 传输到客户端。甚至可以反序列化 phone gap 中生成的二进制文件并使用 Javascript 在 phonegap 中访问这些属性吗?
最佳答案
the Protocol Buffers documentation的第一句是:
Welcome to the developer documentation for protocol buffers – a language-neutral, platform-neutral, extensible way of serializing structured data for use in communications protocols, data storage, and more.
因此,是的,protobuf 是独立于平台的。
至于你是否可以从 JavaScript 使用 protobuf,我会告诉你 this question ,因为总体答案似乎是“仅通过第三方库”。您还可以在 the protobuf project site 上找到一些第三方库。 .
关于c# - Protobuf 消息平台是否独立,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18663051/