I am building a DLL which will be used by C++ using COM.
Please let me know what would be the C# equivalent of C++ 64-bit unsigned long long
.
Will it be ulong type in C# ? Please confirm.
Thanks, Gagan
I am building a DLL which will be used by C++ using COM.
Please let me know what would be the C# equivalent of C++ 64-bit unsigned long long
.
Will it be ulong type in C# ? Please confirm.
Thanks, Gagan
ulong
is short for System.UInt64 which is (and always will be) a 64-bit unsigned integer. –
Convulsion For anything that goes beyond ulong
, you might as well use the C# BigInteger
Structure.
BigInteger
data type. Thanks for sharing. –
Salter ulong
–
Exobiology In C++, the size of integer types varies depending on whether the program is running on a 32- or 64-bit machine, whereas C# integer types are platform-independent. So, they're not interoperable.
Rather, in C# there are the IntPtr
and UIntPtr
types, which are intended for P/Invoke, and whose size is 4 bytes on 32-bit machines and 8 bytes on 64-bit machines, which makes them equivalent to the C++ signed long
and unsigned long
types, respectively.
Since C++11, you can use these:
int8_t
int16_t
int32_t
int64_t
uint8_t
uint16_t
uint32_t
uint64_t
Their size is guaranteed to remain the same regardless of anything.
© 2022 - 2024 — McMap. All rights reserved.
ulong
is a 64-bit unsigned long int. – Matt