Protobuf.net Any数据类型如何使用?

Protobuf.net How to use the Any data type?

我看过示例 *.proto 文件,其中使用了 google.protobuf.Any 数据类型。例如。来自 Eclipse Tahu Sparkplug Version B 规范,其中有类似的内容:

message Row {
    repeated DataSetValue elements  = 1;
    repeated google.protobuf.Any details = 2;
}

当我使用来自 https://protogen.marcgravell.com/ 的转换器时,我在 C# 中收到一条示例消息,其中(当然)使用了类型 Google.Protobuf.WellKnownTypes.Any。现在的问题是:是否有 protobuf.net 的等效项,或者如果不是我可以使用的解决方法?

问得好。多年来,我一直想解决这个问题。答案很简单“不,我什至没看过”。我很乐意这样做,但现实是我的时间有限,需要优先考虑人们要求的功能。直到今天,“任何”是我基本上没有听到过的声音。如果你有一个真正的用例,我们可能会看看。 GitHub 或电子邮件可能是探索它的更好的地方,除非您乐于通过 byte[] 和您自己的代码简单地处理它。