Startsidan  ▸  Texter  ▸  Teknikblogg

Anders Hesselbom

Programmerare, skeptiker, sekulärhumanist, antirasist.
Författare till bok om C64 och senbliven lantis.
Röstar pirat.

Shadowing

2009-05-12

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

Leave a Reply

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



En kopp kaffe!

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

Bjud på en kopp kaffe!

Om...

Kontaktuppgifter, med mera, finns här.

Följ mig

Twitter Instagram
GitHub RSS

Public Service

Folkbildning om public service.

Hem   |   linktr.ee/hesselbom   |   winsoft.se   |   80tal.se   |   Filmtips