As of version 0.7.7 a client API for C# is integrated into the source code distribution. The C# library should run on .NET and Mono 3.x (on Linux and Mac OS X 10.9). Please also refer to the examples provided with the C# API.
The C# code is provided with solution and project files that can be either used with Visual Studio or MonoDevelop (Xamarin Studio).
Build the API and examples on Mono for Linux
To build the tools you can either use MonoDevelop or the xbuild command line tool.
To build on the command line just type:
On a Windows system you can use Visual Studio or the msbuild command line tool respectively.
The C# API requires the library to be built as a shared library/DLL.
The runtime (.NET or Mono) has to be able to find the shared library. This can be done by copying the library to the respective system directory:
On Linux or Mac OS X this is usually
On Windows this is the
Mac OS X:
A simple example application
public static void Main (string args)
var connection = new IedConnection ();
bool stVal = connection.ReadBooleanValue ("simpleIOGenericIO/GGIO1.SPCSO1.stVal",
UInt64 t = connection.ReadTimestampValue("simpleIOGenericIO/GGIO1.SPCSO1.t",
DateTimeOffset timestamp = MmsValue.MsTimeToDateTimeOffset (t);
Console.WriteLine ("SPCSO1.stVal: " + stVal.ToString ());
Console.WriteLine ("SPCSO1.t: " + timestamp.ToString ());
var spcso1 = connection.CreateControlObject ("simpleIOGenericIO/GGIO1.SPCSO1");
The C# API is designed to be as close as possible to the C API without compromising the C# coding style. Main differences are the usage of real instance methods instead of static functions and exceptions instead of call by reference error variables.