Skip to content

Latest commit

History

History
35 lines (27 loc) · 949 Bytes

File metadata and controls

35 lines (27 loc) · 949 Bytes

Methods

(FBWithMethods.cs)

Beside the obligatory methods for initialization and execution, a class can contain optional methods. To make these user methods available in IEC, the attribute [User] is used.

For input methods, the method must be marked with the [Input] parameter.

[User]publicvoidSetX([Input]intx){CurrentPosition.x=x;}

As in the Complex Data Types example, user methods must also return complex types by reference. The return variable must have the method name and marked with the [Output] attribute. Otherwise it will be interpreted as an [InOut].

[User]publicvoidGetPosition([Output]refPositionGetPosition){GetPosition=CurrentPosition;}

NOT SUPPORTED: Complex data types as return value!

[User]publicPositionNotSupported_GetPositionReturningTheStructure(){returnCurrentPosition;}