Partial Classes in VB.Net 2.0

Partial classes exists also in VB2 like C#2.

But the implementation seems to be different.

You define your main class as usual . Only the additional classes have to be marked with the keyword Expands, and they don't need any modifiers. The separation in several files is supported for classes and structures, too.

' Myclass.vb
Public Class Myclass

   Public Sub SomeMethod()
   End Sub

End Class

' Myotherclass.vb
Expands Class Myclass

   Public Sub AnotherMethod()
   End Sub

End Class

No Comments