I have this variables inside a class:
public const ushort HEADER_LENGTH = 5;
public const ushort CHECKSUM_LENGTH = 2;
public ushort longitudTrama;
public ushort longitudTotal;
If I do that:
longitudTotal = longitudTrama;
longitudTotal += HEADER_LENGTH;
longitudTotal += CHECKSUM_LENGTH;
The compiler doesn't generate any error.
But if I do that:
longitudTotal = longitudTrama + HEADER_LENGTH + CHECKSUM_LENGTH;
The compiler says I am missing a cast because it cannot implicitly convert int to ushort. Which int!!??
Thank you.