I suggest you ...

Allow partial constructors in C#

For auto-generated code sometimes it would be useful to to add an additional constructor in a partial class. An example I struck recently was trying to add some additional constructor code to an EF generated class where I didn't have control over the generated code.

An obvious problem is invocation order and I'm not sure of what would be best but perhaps some modifiers could be added to the front of the method:

[InvokeFirst] // Must be first, error on multiple definitions
[InvokeHigher]
[InvokeDefault] // Default when not specified
[InvokeLower]
[InvokeLast] // Must be last, error on multiple definitions

The following question on Stack Overflow shows some current solutions but all require either changing the generated class or it already providing support for it:

https://stackoverflow.com/q/247800/1599751

3 votes
Vote
Sign in
(thinking…)
Password icon
Signed in as (Sign out)
You have left! (?) (thinking…)
PeterJ shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

0 comments

Sign in
(thinking…)
Password icon
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base