[英]Protobuf3 - Protobuf-net get Options/Extensions from C#
I have an opt.proto
file that has the following structure:我有一个具有以下结构的
opt.proto
文件:
extend google.protobuf.MessageOptions {
repeated string class_attr = 3003;
}
extend google.protobuf.FieldOptions {
repeated string field_attr = 3004;
}
and another classext.proto
that has the import from the opt.proto
file:另一个
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;
}
When compiling I need to have access to the extensions and their values so I can add more information when needed.编译时,我需要访问扩展及其值,以便在需要时添加更多信息。 So far I can only access the name of the fields (class_attr, field_attr), but I can't access their values.
到目前为止,我只能访问字段的名称(class_attr、field_attr),但无法访问它们的值。
I saw that for c++ there is something like GetExtension(option)
.我看到对于 c++ 有类似
GetExtension(option)
的东西。
According to this question in 2016, there was no such type of implementation,根据2016年的这个问题,没有这种类型的实现,
Has this been resolved in any way?这有没有以任何方式解决?
Merci.谢谢。
为了解决这个问题,我最终创建了自己的阅读器来加载信息,以便我可以根据需要滚动浏览。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.