I have a C struct that is defined as follows:
typedef struct {
unsigned long int a;
} TEST;
I want to create a C# equivalent of this struct?
Any help? What is confusing me is that "unsigned long int" is at least 32-bit, what does that mean, it's either 32-bit, 64-bit or 16-bit, right?
You want an uint
or ulong
depending on what an int
or long
was on your native C platform:
uint
is 32 bitsulong
is 64 bitsThe at least and platform dependency is a necessary concern in C because it is actually translated into machine code and C was developed for many architectures with varying word sizes. C# on the contrary is defined against a virtual machine (exactly like Java or Javascript) and thus can abstract the hardware's word size in favor of one defined by the language's standard VM (the CLR in C#). Differences between the VM and harware word size are taken care of by the VM and hidden to the hosted code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With