C
C#2y ago
PatrickG

❔ force a ushort value?

if i type for example var num = 25L; i am forcing a long value (int64) how can i force a ushort in the same way?
11 Replies
Buddy
Buddy2y ago
By defining it explicity as ushort
Angius
Angius2y ago
Can't find anything in the docs, oddly enough, but found this: https://www.c-sharpcorner.com/article/data-type-suffixes-in-c-sharp/ Would us work...?
MODiX
MODiX2y ago
thinker227#5176
REPL Result: Failure
1us
1us
Exception: CompilationErrorException
- ; expected
- The name 's' does not exist in the current context
- ; expected
- The name 's' does not exist in the current context
Compile: 323.907ms | Execution: 0.000ms | React with ❌ to remove this embed.
Thinker
Thinker2y ago
huh, thought that worked
MODiX
MODiX2y ago
Angius#1586
REPL Result: Success
1ul
1ul
Result: ulong
1
1
Compile: 288.057ms | Execution: 22.866ms | React with ❌ to remove this embed.
Angius
Angius2y ago
Works for ulongs Not for ushorts tho
Thinker
Thinker2y ago
Smadge
PatrickG
PatrickG2y ago
oh well i endedup doing (ushort)25
Angius
Angius2y ago
Or just use ushort instead of var...?
ero
ero2y ago
short and byte don't have suffixes they used to, actually 1y for byte (???????????) and 1s for short
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.