Partial Modules

Visual Basic 2015 introduces partial modules. Similarly to what you learned about partial classes, with partial modules you can split a module definition across multiple code files. For example, you could extend the definition of the Methods sample module by adding a new code file and then adding a partial module, like this:

Partial Module Methods    Friend Sub DoSomethingElse()        Console.WriteLine("Hey, I live in a partial module!")    End SubEnd Module

You use the Partial keyword here as you do for classes. When you type Partial Module, IntelliSense helps you choose one of the available modules in your project. Partial modules are helpful when you have long module definitions and you want to ...

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.