Defining partial classes

 

Introduction

The definition of a type can be split over two or more source files.  Each source file contains a class definition section, and all the different parts are combined once the application has been compiled.

 

 

Defining a partial class

To split the definition of a class, struct or interface, select the element in the explorer, and then associate the {CsPartial} tagged value (without parameters) to it in the auxiliary window (as shown below).

 

The {CsPartial} tagged value in the auxiliary window

 

Steps:

 

1.      To associate the {CsPartial} tagged value to the element selected in the explorer, click on the "Associate a tagged value" icon in the auxiliary window and select it in the dropdown list.

2.      The {CsPartial} tagged value then appears in the auxiliary window.

 

During code generation, Objecteering C# Developer will then position the new "partial" modifier just before the class, struct or interface keywords.

 

Note:      Several rules concerning the definition of partial classes exist, and it is up to you to be sure that they are followed.  Objecteering C# Developer carries out NO checks on this.