How can I define a const
nuint value with every bit as 1, which is -1
in C#?
#7793
Replies: 2 comments 1 reply
-
https://github.com/dotnet/csharplang/blob/main/proposals/csharp-9.0/native-integers.md
|
Beta Was this translation helpful? Give feedback.
-
I made a quick investigation and apparently it's not possible. Because native ints have variable size, you can only define constants in the 32-bit range. Then, according to Built-in numeric conversions (C# reference), signed types get sign-extended while unsigned types get zero-extended. In other words, you can define a |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
All reactions