Can I add an interface to an object at Runtime?
I would like to create an interface to mirror the Graphics functions, so that I can use the same command across various objects, but at the same time when using the Graphics class, I’d rather not have to replicate the code (thus also hoping for a reduction in stepping through methods).
Interface is a compile-time construct. It doesn’t exist at runtime.
What about a class which implements your interface and maintains a reference to a Graphics object obtained via normal means. You could even use an Operator_Convert(Source As Graphics) to allow “automatic” wrapping of a Graphics object into your custom class. Your wrapper class would basically just relay commands to and from the referenced Graphics object. And since it implements the interface, the calling code doesn’t care what the underlaying implementation is.
While this seems like the best solution, I was hoping to avoid it for the Graphics class, so that I can save some microseconds when drawing to the screen and such.