How I could Import/Implement all the native method

2019-08-18 02:29发布

I have this Class

Imports _Console = System.Console

Public Class ConsoleEx ' : Inherits _Console

    Public Shared Sub MyCustomMethod()
        ' Do something
    End Sub

End Class

And my idea is just to use that Class as a FULL qualified replacement of the Console Class then I would like to be able to use ALL the Console class methods as normally but from my custom ConsoleEx class together with my custom methods, for example:

' Native Console class method:
ConsoleEx.WriteLine(Parametters)

' My custom method:
ConsoleEx.MyCustomMethod(Parametters)

I'm not lazy but I imagine that this could be possibly to do it in one step? Framework does not provide anything to do it?

Which is the easiest way to do it?

1条回答
乱世女痞
2楼-- · 2019-08-18 03:21

(i know this is not really an answer but i cannot comment yet)

I think what you are looking for is some sort of inheritance system but the Console class cannot be inherited. So i think its not possible to do in "one simple step"

Link to MSDN console class

查看更多
登录 后发表回答