Is it possible to override a non-virtual method?
问题 Is there any way to override a non-virtual method? or something that gives similar results (other than creating a new method to call the desired method)? I would like to override a method from Microsoft.Xna.Framework.Graphics.GraphicsDevice with unit testing in mind. 回答1: No, you cannot override a non-virtual method. The closest thing you can do is hide the method by creating a new method with the same name but this is not advisable as it breaks good design principles. But even hiding a