Understanding the generated C# classes

When you generate C# classes, a .cs file is created for each interface selected from the SMC, as well as for each structure, group, and enumeration within the selected interfaces. These generated classes use the xfNetLink .NET classes internally to connect with xfServerPlus and pass data.


See Appendix C: Data Type Mapping for xfNetLink .NET for details on how data types for parameters, return values, and structure fields are mapped from Synergy to .NET.

Procedural classes

The procedural classes (which are derived from the interfaces in the SMC) contain your own user‑defined methods as well as a number of utility methods. You can browse a procedural class using the Object Browser in Visual Studio to see the method signatures.

The following public utility methods are included in every procedural class:


The utility methods enable you to establish a connection with xfServerPlus and perform other utility functions, such as setting a call time‑out value and running a debug session. See Using your Synergy .NET assembly: The basics and the Method reference for more information. Note that although they are included in the C# classes, getConnect() and shareConnect() are not included in the assembly when it is built for pooling. This is because these two methods cannot be used with pooling.

For each procedural class, gencs creates an associated C# interface. The C# interface is named with the class name, with the letter “I” appended to the beginning of the filename. For example, if the class is named AppLogin, the associated C# interface will be named IAppLogin and will be in the file IAppLogin.cs. See Using multiple copies of the same class for information on using the C# interfaces.

Structure classes

The structure classes are built from your structure definitions in the repository. Fields in the repository structure become either properties of the structure class or public fields (if you ran gencs with the ‑g option or selected “Fields” for “Generate structure members as” in Workbench). By default, the properties or fields are named with the repository field name; see Passing structures as parameters for details on overriding the default name.

If there are groups within your repository structures (or fields declared in the repository as “struct” data type), a class will be generated for each group, and each field in the group will be a property/field of that class.

The following public utility methods are included in every structure class:


For more information about the structure and group classes, see Using structures in xfNetLink .NET. For more information about the utility methods, see the Method reference.

DataTable classes

If you indicated in the SMC that a structure collection or an ArrayList of structures should be created as a DataTable, in addition to the structure class, your assembly will include a DataTable class, which is named with the structure name plus “DT” (e.g., MystructDT).

Each row in the table consists of a structure class, and each column represents a field, which is usually named with the repository field name. Groups within the structure are “flattened” and included in the table with their parent structure.

The following public utility methods are included in every DataTable class:


For more information about the DataTable classes, see Using DataTables. For more information about the utility methods, see the Method reference.


Enumeration types are built from your enumeration definitions in the repository. There will be a .cs file, named with the enumeration name, for each repository enumeration that is referenced as a parameter or return value in the SMC, as well as for those enumerations that are referenced as fields within a structure that is passed as a parameter.

For more information, see Using enumerations in xfNetLink .NET.

Custom attributes

xfNetLink .NET uses a custom attribute class to hold metadata about the Synergy routines, such as the type and size of parameters for a method call. At runtime, xfNetLink .NET uses reflection to look at the attributes and get this information. It is very important that you not edit the custom attributes. Doing so will cause errors at runtime.