Following on from this question, what would be the best way to represent a System.Decimal object in a Protocol Buffer?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well, protobuf-net will simply handle this for you; it runs off the properties of types, and has full support for
decimal. Since there is no direct way of expressingdecimalin proto, it won’t (currently) generate adecimalproperty from a ‘.proto’ file, but it would be a nice tweak to recognise some common type (‘BCL.Decimal’ or similar) and interpret it as decimal.As for representing it – I had a discussion document on this (now out of date I suspect) in the protobuf-net wiki area; there is now a working version in protobuf-net that simply does it for you.
No doubt Jon and I will hammer this out more later today ;-p
The protobuf-net version of this (in .proto) is something like (from here):