Klaus Even Enevoldsen DK

I have been looking at the June 2007 CTP and saw the Partial Methods in action for the first time (in the autogenerated code for the DataContext in "LINQ To SQL".

Why do you have to write "End Sub" when there cannot be any implementation between "Sub "and "End Sub" Why not just do the same as with Virtual Methods (MustOverride) and just keep the method signature

Existing syntax:
Partial Private Sub OnLoaded()
End Sub

Suggested syntax:
Partial Private Sub OnLoaded()


Re: Visual Basic 2008 (Pre-release) Partial Method Syntax is Wierd...

Klaus Even Enevoldsen DK

I got this reply from Microsoft:

Hi Klaus, Thanks for the suggestion. The reason we're require the End Sub is we'd like the ability to allow for a "default implementation" in a future release, and requiring the End Sub gives us more flexibility down the road. The idea would be that the person writing the code generator could provide some default logic for the method (say for validation), which other developers could then call into and/or override. Thanks! Jonathan Aneja Program Manager, VB Team