Overview
C# Target
C# target name is csharp. It must be used for the attribute target for attributes
controlling C# code generation:
[csharp namespace="Protocol"]
It is also used as the Igor Compiler command line argument for the -target option:
igorc.exe -t csharp *.igor
-cs option is the shortcut -t csharp.
C# Versions
Igor can use C# features of recent versions in generated code. Currently the minimum supported version is C# 4.0. The default is 5.0.
You can enable features of newer versions with -target-version command line argument.
Example:
igorc.exe -cs -target-version 7.1 *.igor
Here’s the list of C# features that Igor uses:
Feature |
Version |
Example |
|---|---|---|
Async tasks |
5.0+ |
|
Index initializers |
6.0+ |
|
nameof |
6.0+ |
|
Readonly properties |
6.0+ |
|
out var |
7.0+ |
|
is null |
7.0+ |
|
Default literals |
7.1+ |
|