"C#" language specificities

Telosys version : 4.1.0



To define C# as the target language call  #set( $env.language = 'C#' )  in the templates files.

The information below shows the behavior of the generator when 'C#' is the current target language.



Type conversion ( model type to language type )

The language type conversion has an impact on :
Model type     Default        @UnsignedType @NotNull       @PrimitiveType @ObjectType   
string string? string? string string? String?
byte sbyte? byte? sbyte sbyte? SByte?
short short? ushort? short short? Int16?
int int? uint? int int? Int32?
long long? ulong? long long? Int64?
decimal decimal? decimal? decimal decimal? Decimal?
float float? float? float float? Single?
double double? double? double double? Double?
boolean bool? bool? bool bool? Boolean?
date DateOnly? DateOnly? DateOnly DateOnly? DateOnly?
time TimeOnly? TimeOnly? TimeOnly TimeOnly? TimeOnly?
timestamp DateTime? DateTime? DateTime DateTime? DateTime?
binary byte[]? byte[]? byte[] byte[]? byte[]?

Remarks

'@UnsignedType' has effect only for byte, short, int, long
'@ObjectType' switches to .Net types ( System.Int64, System.Boolean, etc)

'@NotNull' has no effect, use '$csharp' object for 'nullable type' with '?'
'@PrimitiveType' has no effect



Literals for TRUE, FALSE and NULL

TRUE true
FALSE false
NULL null


Literal values

Model type Language type Language full type Language literal value example
string string? string? "AAA"
string string string "AAA"
string String? System.String? "AAA"
byte sbyte? sbyte? 1
byte byte? byte? 1
byte sbyte sbyte 1
byte SByte? System.SByte? 1
short short? short? 1
short ushort? ushort? 1
short short short 1
short Int16? System.Int16? 1
int int? int? 100
int uint? uint? 100
int int int 100
int Int32? System.Int32? 100
long long? long? 1000L
long ulong? ulong? 1000L
long long long 1000L
long Int64? System.Int64? 1000L
decimal decimal? decimal? 10000.77M
decimal decimal decimal 10000.77M
decimal Decimal? System.Decimal? 10000.77M
float float? float? 1000.5F
float float float 1000.5F
float Single? System.Single? 1000.5F
double double? double? 1000.66D
double double double 1000.66D
double Double? System.Double? 1000.66D
boolean bool? bool? true
boolean bool bool true
boolean Boolean? System.Boolean? true
date DateOnly? System.DateOnly? null
date DateOnly System.DateOnly null
time TimeOnly? System.TimeOnly? null
time TimeOnly System.TimeOnly null
timestamp DateTime? System.DateTime? null
timestamp DateTime System.DateTime null
binary byte[]? byte[]? null
binary byte[] byte[] null