3 ms·
Interestingly enough, there are no primitive types in C#; that's a Java term. I'd probably ask for what definition they're after because I can think of a few:
by ygra 2y ago
Interestingly enough, there are no primitive types in C#; that's a Java term. I'd probably ask for what definition they're after because I can think of a few:
• Types that have a type alias (that makes them special in the language), but that would include string and object.
• Value types that have a type alias. Closer to what Java does and would include most basic numeric types. But it would exclude System.Half and System.Int128 for example.
• Value types that the runtime knows about and might treat in a special way (e.g. by also having specific IL instructions for them). That would include most basic numeric types (and enums), but probably exclude boolean, decimal and the newer ones.
• Value types in general, as they all function similarly, regardless of whether it's bool, int, ValueTuple<float, ushort> or an enum. But that list is no longer finite.
But perhaps the following discussion about types in C# and .NET was what they're after. Who knows.
- xnorswap 2y agoIt was 18 months ago, I may have misremembered the exact term the used. They wanted this list essentially: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/built-in-types https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...