Option to Suppress Constructor Generation

Jan 8, 2010 at 4:44 PM

Do you think you could include an option that would suppress constructors from being generated in the generated Request/Response type classes?  I think this might only need to be enabled if you have "Public Properties" checked.

Rationale:  I like to use object initializers instead of constructors in the client code, and having constructors (both the empty parameterless constructor as well as the constructor that sets every property in the class) are not necessary when you take advantage of object initializers.  Oh and cutting out the constructor code reduces overall code and just makes it neater (imo).

I know having the 2 constructors in the code doesn't prevent object initializer use, and furthermore that they are absolutely necessary in versions of .Net less than 3.0 (maybe it's 3.5; I'm not sure).  However, I like to omit them (in fact, I go through the generated code and remove them and convert any constructor calls to object initializer calls).

The motivation for this is, as some might have guessed, ReSharper.  I personally like the code I write to conform to ReSharper's default settings, and by default, it suggests that you use object initializers (oh and the var keyword your friend as well).

If you want, I can try to get an example together of what I'm talking about in before and after code.


Jan 13, 2010 at 12:48 PM

Hi Chris,

I'll take a look and see if this is possible.