【发布时间】:2022-06-30 20:08:00
【问题描述】:
我有一个opt.proto 文件,其结构如下:
extend google.protobuf.MessageOptions {
repeated string class_attr = 3003;
}
extend google.protobuf.FieldOptions {
repeated string field_attr = 3004;
}
另一个classext.proto 具有从opt.proto 文件导入:
message Stream
{
option (class_attr) = "TestClassAttribute";
option (class_attr) = "TestClassAttribute2";
string id = 1 [(field_attr) = "TestFieldAttribute", (field_attr) = "TestFieldAttribute"];
string description = 2;
string path = 3;
}
编译时,我需要访问扩展及其值,以便在需要时添加更多信息。到目前为止,我只能访问字段的名称(class_attr、field_attr),但无法访问它们的值。
我看到对于 c++ 有类似 GetExtension(option) 的东西。
根据这个question在2016年没有这种类型的实现,
这个问题解决了吗?
谢谢。
【问题讨论】:
标签: c# protocol-buffers protobuf-net