Short answer, No. In C#, there's no letter S
that could be used as var a = 123S
that would indicate that a
is of type short
. There's L
for long
, F
for float
, D
for double
, M
for decimal
, but not S
. It would be nice if there was, but there isn't.
var a = 1M; // decimal
var a = 1L; // long
var a = 1F; // float
var a = 1D; // double
var a = 1; // int
var a = 1U; // uint
var a = 1UL; // ulong
but not
var a = 1S; // not possible, you must use (short)1;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…