Splitting Method Definitions with Partial Methods
Another interesting feature is partial methods. The concept behind this feature is the same as for partial classes: Method implementations can be split across multiple parts. Partial methods have three particular characteristics: They must be Private
methods, they cannot return values (that is, only Sub
methods are allowed), and their bodies must be empty in the class in which methods are defined. Consider the following code, in which a class named Contact
is split across partial classes and a partial method is defined:
Public Class Contact Public Property FirstName As String Public Property LastName As String Public Property EmailAddress As String Public ...
Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.