No, you can't create your own form of literal in C#.
You could have an implicit conversion from int
, long
, uint
and ulong
, allowing:
Int128 a = 100;
but you wouldn't be able to specify values greater than ulong.MaxValue
that way.
Having an implicit conversion from decimal
would allow a larger range, but would be a bad idea because you would lose data for any value which wasn't just an integer.
Basically there's nothing which will allow a literal guaranteed-to-be-integer value greater than ulong.MaxValue
- you could parse a string, but that's not really ideal. Alternatively you could create a constructor which took two ulongs, one for the bottom 64 bits and one for the top 64 bits.