C#

To define C# as the target language in a template file :

#set( $env.language = 'C#' )

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

Types conversion

The table below describes how model neutral types are automatically converted to C# types with potential impact due to attribute annotations.

Model type

C# type

with annotation

string

string String

@ObjectType

byte

sbyte byte SByte

@UnsignedType @ObjectType

short

short ushort Int16

@UnsignedType

@ObjectType

int

int uint Int32

@UnsignedType

@ObjectType

long

long

ulong

Int64

@UnsignedType

@ObjectType

decimal

decimal

Decimal

@ObjectType

float

float Single

@ObjectType

double

double Double

@ObjectType

boolean

bool Boolean

@ObjectType

date

DateTime

time

DateTime

timestamp

DateTime

binary

byte [ ]

Annotations effects

  • @UnsignedType has effect only for byte, short, int, long

  • @ObjectType switches to .Net types ( System.Int64, System.Boolean, etc)

  • @NotNull no effect

  • @PrimitiveType no effect

Specific types

  • $attribute.fullType returns the C# System class full name for both "primitive type" and "object type" ( for example : System.String, System.Int16, System.Decimal )

  • $attribute.simpleType

    • for an "object type" returns the simple type name of the C# System class ( for example : String, Int16, Decimal )

    • for a "standard type" returns the usual type ( for example : string, int, uint, bool )

  • $attribute.wrapperType returns the C# System class associtated with the curren type

Literal values

TRUE, FALSE, NULL

C# literal

TRUE

true

FALSE

false

NULL

null

Generated literal values

Below some examples of literal values generated for each type :

Model type

C# type

C# literal value

string

string

System.String

"AAA"

byte

sbyte

byte

System.SByte

1

short

short ushort System.Int16

1

int

int uint System.Int32

100

long

long

ulong

System.Int64

1000L

decimal

decimal System.Decimal

10000.77M

float

float System.Single

1000.5F

double

double System.Double

1000.66D

boolean

bool System.Boolean

true or false

date

System.DateTime

null

time

System.DateTime

null

timestamp

System.DateTime

null

binary

byte [ ]

null