How to enforce a method call (in the base class) when overriding method is invoked?
I have this situation that when AbstractMethod method is invoked from ImplementClass I want to enforce that MustBeCalled method in the AbstractClass is invoked. I’ve never come across this situation before. Thank you! public abstract class AbstractClass { public abstract void AbstractMethod(); public void MustBeCalled() { //this must be called when AbstractMethod is invoked } } public class ImplementClass : AbstractClass { public override void AbstractMethod() { //when called, base.MustBeCalled() must be called. //how can i enforce this? } } An option would be to have the Abstract class do the