New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
it does support GetExtension like c++ #1603
Comments
No - extensions are only supported in proto2, and the C# implementation only supports proto3. |
thank u for your reply, but when i write syntax = "proto3"; How can i get my_option value("Hello world!") from MyMessage? Does it support this? |
I don't think so, no. The parser ignores any fields it doesn't understand, which would include @xfxyjwf I haven't heard about this being a requirement for proto3 code - thoughts? |
I saw it at : https://developers.google.com/protocol-buffers/docs/proto3#options
I think "Custom Options" is a very good point. And supported in proto3. But in csharp I can not find. Detail info : https://developers.google.com/protocol-buffers/docs/proto#customoptions Thank u for your time. |
Right, I'm almost entirely certain that we don't support it at the moment. Hopefully Feng Xiao can comment on whether this is required for GA or whether we can add it later. |
Sorry to hear that. I want to know whether you will add it, and when will it work...If you would not support it. I plan to do it, while it is very hard for me, haha...So should you give me an answer? |
The descriptor proto representations are internal for two reasons:
Basically, information about descriptors is exposed via We'll update this issue with plans, but that's not my decision to make. |
Thank u for your time, Waiting for Feng Xiao to answer.. |
I think we will eventually support accessing custom options in proto3. It's not a requirement for GA though as it's an advanced feature that most users probably don't even know about. Currently only languages that support proto2 extensions allow access to custom options. |
May I know how long can I use this feature? For in my project I will use it... |
Well, pull requests are always welcome, but we mustn't expose the underlying proto objects here. I'd expect some method specifying a field number and a type to deserialize the option as. |
Closing this as a duplicate of #2143. |
import "google/protobuf/descriptor.proto";
extend google.protobuf.MessageOptions {
optional string my_option = 51234;
}
message MyMessage {
option (my_option) = "Hello world!";
}
string value = MyMessage::descriptor()->options().GetExtension(my_option);
how c# can do that?
The text was updated successfully, but these errors were encountered: