C
C#3y 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
Buddy3y ago
By defining it explicity as ushort
Angius
Angius3y 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
MODiX3y 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
Thinker3y ago
huh, thought that worked
MODiX
MODiX3y 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
Angius3y ago
Works for ulongs Not for ushorts tho
Thinker
Thinker3y ago
Smadge
PatrickG
PatrickGOP3y ago
oh well i endedup doing (ushort)25
Angius
Angius3y ago
Or just use ushort instead of var...?
ero
ero3y ago
short and byte don't have suffixes they used to, actually 1y for byte (???????????) and 1s for short
Accord
Accord3y 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.

Did you find this page helpful?