Skip to content
Collection of various C# sample code for PLCnext Technology controllers.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

PLCnext Technology - C# Examples

Feature Requests Bugs License Web Community

PLCnext Technology integrates programming of different languages, and enables users to create real time components in C# using their familiar Microsoft® Visual Studio® as the integrated development environment. For More information please visit our Community.

The CSharpExamples repository is a collection of various examples for PLCnext Technology controllers. It is assumed that the reader has basic knowledge about C# programming in general and has read the User Manual and the PLCnext Technology Quick Start Guide. Each example explains one or more topics. Specific explanations can be found in the file located next to the ExampleName.cs

Table of Content

# Topic Content
01 Basics Implements a basic counter. (Basics.cs)
02 Any Function and function block with "ANY" parameter. (FunWithAny.cs, FB1WithAny.cs, FB2WithAny.cs)
03 User Struct Function block with a user struct. (FBWithUserStruct.cs)
04 User Array Function block with a user array. (FBWithUserArray.cs)
05 IEC String Use type IecStringEx for strings in PLCnext Engineer. (FBWithString.cs)
06 Complex Data Types Complex data type as function's return value. (FUWithComplexDataType.cs)
07 Methods An example for providing Methods written in C# that can be used in IEC language. (FBWithMethods.cs)
08 File Handling Use "File" in namespace System.IO (WriteFile.cs, ReadFile.cs)
09 DateTime Getting UTC ticks and conversion into a string. (FBWithDateTime.cs)
10 Garbage Collection Shows how to modify garbage collection settings. (GarbageCollection.cs)
99 MiscAttributes Making data visible in OPC UA and when to use explicit IEC data type definition. (MiscAttributes)

Getting Started

Find all information how to start coding C# for PLCnext Technology in our Community or watch the Youtube Playlist on your Technical Support Channel


You can participate in this project by submitting bugs and feature requests. Furthermore you can help us by discussing issues and let us know where you have problems or where others could struggle.


Provide information how feedback can be given e.g.:


Copyright (c) Phoenix Contact Gmbh & Co KG. All rights reserved.

Licensed under the MIT License.

You can’t perform that action at this time.