Skip to content

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#.

Categories: Visual Basic 9.

Comment Feed

No Responses (yet)



Some HTML is OK

or, reply to this post via trackback.