Supported data types in C#
The following table illustrates how the IEC 61131‑3 data types are linked to the .Net framework and to C#, respectively.
Note: Variables of data types that are marked with a + in the Attribute mandatory column must have the (otherwise optional) attribute DataType
for unambiguous assignment.
IEC 61131-3 data type | .Net framework data type | C# data type | Attribute mandatory |
BOOL | System.Boolean | bool | – |
SINT | System.SByte | sbyte | – |
BYTE | System.Byte | byte | + |
USINT | System.Byte | byte | – |
INT | System.Int16 | short | – |
DINT | System.Int32 | int | – |
LINT | System.Int64 | long | – |
UINT | System.UInt16 | ushort | – |
UDINT | System.UInt32 | uint | – |
ULINT | System.UInt64 | ulong | – |
WORD | System.UInt16 | ushort | + |
DWORD | System.UInt32 | uint | + |
LWORD | System.UInt64 | ulong | + |
REAL | System.Single | float | – |
LREAL | System.Double | double | – |
TIME | System.Int32 | int | + |
LTIME | System.Int64 | long | + |
LDATE | System.Int64 | long | + |
LTIME_OF_DAY | System.Int64 | long | + |
LDATE_AND_TIME | System.Int64 | long | + |
DWORD | System.UInt32 | uint | + |
LWORD | System.UInt64 | ulong | + |
STRING | System.Iec61131Lib.IecStringEx | – | – |
WSTRING (from 2021.6) | System.Iec61131Lib.IecWString (from 2021.6) | – | – |
ANY | System.Iec61131Lib.Any | – | + |
ANY_MAGNITUDE | System.Iec61131Lib.Any | – | + |
ANY_NUM | System.Iec61131Lib.Any | – | + |
ANY_INT | System.Iec61131Lib.Any | – | + |
ANY_SIGNED | System.Iec61131Lib.Any | – | + |
ANY_UNSIGNED | System.Iec61131Lib.Any | – | + |
ANY_REAL | System.Iec61131Lib.Any | – | + |
ANY_BIT | System.Iec61131Lib.Any | – | + |
ANY_ELEMENTARY | System.Iec61131Lib.Any | – | + |
ANY_STRING | System.Iec61131Lib.Any | – | + |
• Published/reviewed: 2024-10-30 ☀ Revision 074 •