ebceu4 / protobuf-csharp-port

Automatically exported from code.google.com/p/protobuf-csharp-port
0 stars 0 forks source link

Feature: Builder.ToString() should act like Message.ToString() #73

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Builder.ToString() calls object.ToString() which is not very helpful. Ideally, 
it should override it and call result.ToString().

Original issue reported on code.google.com by igorga...@gmail.com on 21 Feb 2014 at 11:03

GoogleCodeExporter commented 9 years ago
When you say result.ToString(), do you mean Build().ToString()? I'm *more* 
happy with this idea than with the Equals one, but I'd still be interested in 
knowing the use case. Is this primarily for when you're debugging/testing?

Original comment by jonathan.skeet on 5 Apr 2014 at 3:15

GoogleCodeExporter commented 9 years ago
Just checked, and the Java code does print in the same way as the message. It 
uses MessageOrBuilder, which doesn't currently exist in protobuf-csharp-port. I 
could look at whether now might be the time to introduce IMessageOrBuilder... 
it may even be trivial.

Original comment by jonathan.skeet on 7 Apr 2014 at 2:57

GoogleCodeExporter commented 9 years ago
I don't remember exactly the use case. But it feels like the right thing to do. 
BTW, Builders don't look good on VS debugging view because of that.

Original comment by igorga...@gmail.com on 7 Apr 2014 at 3:02

GoogleCodeExporter commented 9 years ago
Righto. Haven't added IMessageOrBuilder yet - just added appropriate overloads 
to TextFormat, and an override of ToString in AbstractBuilder. Should be fine 
now.

Original comment by jonathan.skeet on 7 Apr 2014 at 4:36