leejw51 / protobuf-net

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

Default Constructors are not needed. #95

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The generated code includes a default constructor for each object but it 
doesn't contain any code. By default if there are no constructors for an 
object the compiler will generate a default constructor. This will allow 
someone to define a parameter less constructor in a different file since each 
class is defined with the partial keyword. 

BTW Great project. I really dig it. 

Original issue reported on code.google.com by jcustenb...@gmail.com on 24 Feb 2010 at 12:19

GoogleCodeExporter commented 9 years ago
It is intentional and consistent with a lot of typegen code. The reason is that 
this is 
a `partial` class, and the developer might be adding other code (for example a 
custom 
constructor) to *their* half of the class (in a different) file. Adding a 
bespoke 
constructor should not stop the system working, so adding a *defined* 
parameterless 
constructor helps.

Original comment by marc.gravell on 24 Feb 2010 at 11:10

GoogleCodeExporter commented 9 years ago
It makes sense to ensure that the constructor is consistent from the initial 
version. I 
can move to a static method for the creation as easily. thx.  

Original comment by jcustenb...@gmail.com on 24 Feb 2010 at 12:14

GoogleCodeExporter commented 9 years ago
Sounds like no action required then?

Original comment by marc.gravell on 24 Feb 2010 at 1:15