Shadowing

One feature that I use every day, really every day, in Visual Basic is shadowing. Like the keyword “new” in C#, it is used to override a method that is not overridable, but unlike the new keyword, shadowing replaces all overloads of a function in the base class. This is so very usefull. Imagine that you are designing a custom dialog, and you want certain arguments to be passed to the ShowDialog function. Create e shadow of  it, and code that calls ShowDialog must pass the arguments you have specified in the shadow. It could look like this:

Public Shadows Function ShowDialog(ByVal Owner As IWin32Window, ByVal EntityID As Integer) As DialogResult

This is the one thing that I really miss in C#.

Bjud mig på en kopp kaffe (20:-) som tack för bra innehåll:

Bjud mig på en kopp kaffe (20:-) som tack för bra innehåll!

Comments

Important information: If you have not commented before, your comment will be reviewed before it is published. This means that you will not see it immediately, but I have received it. This is not because I want to filter comments, but because I want to prevent spam and advertising.

Leave a Reply

Your email address will not be published. Required fields are marked *