The C# Snippet transform is a quick way of creating transforms without the need for a compile/build environment.

Useful for transforms of as many as a few dozen lines of C# code.

A C programmer can pick up C# without too much difficulty.

No compiler is needed. It is built into MxSuite.

When created, The Transform has one inport and one outport, both continuous floating point. Use the Verbs (links) at the bottom of the Properties box to add or remove ports. Once the classification has been set, you can use the Edit Port command to change the other properties. Event and array Signals are not supported. For message ports, see Message Signals.



Note: Once a port has been created, you cannot change its classification. Instead, delete the port and create a new one.

Click Edit C# to open the C# Snippet dialog box:


Click the Compile button to check your code for syntax errors. Click the View Code button to see your code in context. The Execution Code is executed whenever the Transform is ticked. The Persistent Code is part of the Class definition.

To change the name or type of a port, use the Verbs to remove the old port and add a new port with the new name and type. Do not use the Edit Port dialog or the Properties Box to rename a port. Be sure to change the corresponding variables in the C# code. Spaces are not permitted in port names.

For an example using the C# Snippet, see Getting Started with a Custom Harness.

Although they are similar, do not confuse the C# Snippet Transform, which is used in MxTransIt, with the Signal Generator or the In-Line Transform, which are used in MxVDev.

hmtoggle_plus1Message Signals
hmtoggle_plus1Enable Periodic Ticking

Related Topic:

User-Defined Transforms

Getting Started with a C# Snippet