Industrial Data Science
in C# and .NET:
Simple. Fast. Reliable.
 
 

ILNumerics - Technical Computing

Modern High Performance Tools for Technical

Computing and Visualization in Industry and Science

tgt

C# Initializers with Group

Group implements IEnumerable<Node> and provides an appropriate Add() method. Hence, it can be used in conjunction with the convenient initialization syntax of C# 3.0. In the next example, a scene is created which consists out of a moving gear. The whole setup including the configuration of all nodes is basically done in one single expression.

In order to run the example, copy the code into the ilPanel1_Load handler of a Windows.Forms application project. The code component below is not (yet) able to show animations. Panel is.

Note how the example utilizes C# 3.0 Collection and Object Initializers. In situations, where objects must not get referenced after creation, initializers are often able to realize a very short and expressive syntax.