Protobuf.net How to use the Any data type?

Viewed 474

I have seen example *.proto files where a google.protobuf.Any data type is used. E.g. from the Eclipse Tahu Sparkplug Version B specification where there is something like:

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

When I use the converter from https://protogen.marcgravell.com/, I get an example message in C# where (of course) the type Google.Protobuf.WellKnownTypes.Any is used. The question is now: Is there an equivalent for protobuf.net or if not a workaround I can use?

1 Answers

Excellent question. I've been meaning to address this area for ages. The answer is a simple "no, I haven't even looked at it". I'd be happy to do so, but reality is that I have limited time and need to prioritise effort on features people are asking for. "Any" is something I've heard basically no noise about, until today. If you have a genuine use case for it, we can probably look. GitHub or email may be a better place to explore it, unless you're happy to handle it simply via byte[] and your own code.

Related