Skip to content
Discussion options

You must be logged in to vote

It should be noted that the PRE and POST at compile time could possible just add the base call at the start/end of the override method like regular override - but the keyword makes it easier for programmers not to have to remember what does and what optionally requires the base method call.

If you want to code using the pattern you've mentioned, you can already accomplish this today with Roslyn. specifically define your own 'PreExtendAttribute' and 'PostExtendAttribute's. Then just write this:

[PreExtend]
protected virtual void PreInit(){}
[Extend]
protected virtual void Init(){}
[PostExtend]
protected Extended void PostInit(){}

Then write a Roslyn Analyzer that checks for whatever cont…

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by YairHalberstadt
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #1734 on October 18, 2020 07:35.