Class across multiple modules.

sanganaksakha

New member
Joined
Jun 2, 2012
Messages
3
Programming Experience
5-10
Can I define my VB.Net class across multiple modules?

I have a class that has many subs, I want to spread them across multiple modules for better management.
 
Defining class over multiple files can be done using the Partial keyword. Partial (Visual Basic)
Note this:
Under normal circumstances, you should not split the development of a single class or structure across two or more declarations. Therefore, in most cases you do not need the Partial keyword.
It is possible to arrange code in #Region blocks for easier management.
You can also split view the code window for a single class to better work with two different parts of it at the same time.
New in VB 2012 is you can use Solution Explorer to expand class files into members for easier navigation, Object Browser window provide same functionality now.
Something I often use is context menu choice 'Go To Definition' to navigate to particular places in code fast, instead of browsing the code looking for the member.
One more thing to remember, if a type you define gets too large, maybe code should be refactored, perhaps it contains functionality that logically belongs as separate types.
 
Back
Top