The examples provided in “NETEX/EX13” illustrate the possibility to extend FeResPost classes in C# by defining “extension” methods. Note however that this capability exists only if a version 3 or above of the C# compiler is used.
In the following example, extracted from “NETEX/EX13/extendedCla.cs”, The ClaMat class is extended with method “write_Compliance”:
Note that the first argument is “this ClaMat m”, which indicates the class that is being extended. In file “NETEX/EX13/extendedCla.cs”, the extension methods are defined in “extension” namespace. A “using extension” statement must be present in the client program to access the extensions.
Note also, that many of the methods defined in C# differ from the ruby corresponding ruby methods with ruby extension. For example, the following C# source lines take into account that “getPliesStresses” method of .NET assembly returns a 2D Array:
Ruby extension returns an Array of Arrays and the corresponding lines would be: