Supported functions for C# programming

 C# language functions

Types

All the integrated types are supported, except for decimal

Type system

  • namespaces, structs, classes, interfaces, enumerations, nested types
  • indexers, properties, operations
  • events, delegates, MultiCastDelegates
  • arrays
  • constructors, static constructors, destructors (finalizers)
  • boxing, unboxing, static casts
  • nullable

Polymorphy

  • Virtual mechanism (virtual, overwrite, abstract)
  • Dynamic casts (as)

Modifiers and keywords

  • public, internal, protected, private
  • readonly, const, sealed, unsafe
  • params, ref, out
  • base, this
  • explicit, implicit, operator

Operators

  • new, sizeof, typeof, as, is
  • all unary operators
  • all binary operators
  • prefix, postfix and conditional operator
  • cast and index operator

Control structures and statements

  • if, else
  • switch, case, default (also on strings)
  • for, do, while, foreach, break, continue
  • goto, return
  • using, fixed
  • lock

Exceptions

  • throw
  • try, catch, finally

 

Please refer to Known Issues and Constraints section you find in the online help embedded in every C# project that is derived from one of the templates.
  Here you find that information:Click to show where it is

 

In Visual Studio, open your C# project and expand the EclrFirmwareLibrary branch in the Solution Explorer in the upper right corner of the screen.

PLCnext_VS_SolutionExplorer_CHM_Readme.png

 Base class libraries

Below you will find a list of the most important classes that have been implemented in the eCLR base class library, separated by namespaces.

A complete list of the implemented classes with additional information is available in Section “eCLR Base Class Libraries Reference” of the eCLR-Programming-Reference.chm online help embedded in every C# project derived from one of the templates (Click to show where it is).

System

All integrated types, as well as the following:

  • Char, Boolean, Int32, Single, etc., with the exception of decimal
  • All common exception types
  • Common interfaces such as:
    IDisposable, IComparable, ICloneable, IFormatProvider, IFormattable
  • String, array, object, valuetype
  • Version, DateTime, TimeSpan, TimeZone
  • BitConverter, Convert
  • GC
  • Console
  • Uri, UriBuilder

System.Collections

  • IEnumerator, IEnumerable, ICollection, IList, IDictionary, IComparer
  • ArrayList, Hashtable, Queue
  • Comparer, DictionaryEntry

System.Collections.Generic

  • IEnumerator<T>, IEnumerable<T>, ICollection<T>, ICollection<T>, IList<T>,
    IDictionary<TKey,TValue>, IComparer<T>
  • Dictionary<TKey,TValue>, List<T>, Queue<T>
  • Comparer<T>, KeyValuePair<TKey,TValue>

System.Globalization

  • Calendar, CalendarWeekRule
  • CultureInfo
    Supported cultures: de-DE, en-US, en-GB, Invariant
    Types that support the localized formatting/parsing: all number types, DateTime, Time­Span
  • DateTimeFormatInfo, NumberFormatInfo, NumberStyles, DateTimeStyles

System.IO

  • Path, File
  • Stream, FileStream, MemoryStream
  • BinaryReader, BinaryWriter
  • TextReader, TextWriter, StreamReader, StreamWriter, StringReader, StringWriter

System.Security.Cryptography

  • CryptoConfig
  • HashAlgorithm, MD5, MD5CryptoServiceProvider

System.Text

  • StringBuilder
  • Encoding, ASCII Encoding, UTF8 Encoding, Unicode Encoding (big endian and little endian)

System.Threading

  • Thread, ThreadPool, ThreadStart, ThreadState
  • Monitor (lock)
  • WaitHandle, EventWaitHandle, AutoResetEvent, ManualResetEvent, WaitCallback
  • Timer, TimerCallback

System.Net

  • IPAdress, IPEndpoint, Endpoint, SocketAddress

System.Net.Sockets

  • NetworkStream
  • AddressFamily, ProtocolType
  • Socket, SocketType

 eCLR runtime functions

Garbage collection

Memory management is performed by the eCLR. The garbage collector should explicitly only be called at a specific point in time (application of GC.Collect).

Implicit finalization

The finalizer of each applicable .NET class (implementing ~T()) is called when the garbage collector releases the instance. The garbage collector collect function is called automatically. The time of the implicit call cannot be predicted.

Implicit initialization

All the integrated types and value types (struct) are implicitly initialized with their default val­ues. Reference type instances are implicitly initialized with the value “zero”.

Debug support

  • Defining breakpoints
  • Evaluation of instance values and local variables, as well as arguments from the current method
  • Providing call stack information

Known issues and constraints

Please refer to Known Issues and Constraints section of the online help that is embedded in every C# project derived from one of the templates.
Here you find the online help file:Click to show where to find the online help

In Visual Studio, open your C# project and expand the EclrFirmwareLibrary branch in the Solution Explorer in the upper right corner of the screen.

PLCnext_VS_SolutionExplorer_CHM_Readme.png

 

 


• Published/reviewed: 2024-10-30   ☀  Revision 074 •