【问题标题】:How to compare two protobuffer files in c#如何在c#中比较两个protobuf文件
【发布时间】:2018-02-13 08:21:15
【问题描述】:

我在我的 .net 应用程序中使用 protobuf-net 2.3.2 来生成缓冲区文件。

public class EmailData
{
    public string FirstName{ set; get; }
    public string LastName { set; get; }
    public Location Location { set; get; }
}

public class Location
{
    public string LocaitionName{ set; get; }
    public string ZipCode{ set; get; }   

}

我想知道是否有任何 api 来比较使用 EmailData 类生成的 2 个缓冲区文件

【问题讨论】:

  • 如果不将它们反序列化回对象,我认为这是不可能的......

标签: c# protocol-buffers protobuf-net


【解决方案1】:

你不能。二进制数据可能是相同的(而且经常是),但这不是硬性保证——相同的语义数据可以用不同的字节数据表示。所以:你需要单独反序列化和处理它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多