0

Is there a way to emulate special C datatypes, like uint64 (_int64), anyID (_int16) in C#? I defined the special datatypes in C like this:

typedef unsigned _int16 anyID;
typedef unsigned _int64 uint64;

Its for using the TS3 Plugin API. It has to be C# though, and I just want to use the from TS3 defined C datatypes in C#.

J.Horr
  • 117
  • 1
  • 13

3 Answers3

2

The equivalent of a typedef is using:

using anyID = System.UInt16;
using uint64 = System.UInt64;

The sizes of the different numeric types in C# can be found here: Integral Types Table.

One thing to note: the sizes of the different numeric types are fixed in C#, unlike in C where they are platform-dependent, so it's usually redundant to define aliases for numeric type sizes like int64.

Alex
  • 7,728
  • 3
  • 35
  • 62
0

unsigned ints are already predefined See MS c# types

in short: ushort is an unsigned 16bit int, and ulong is an unsigned 64bit int..

BugFinder
  • 17,474
  • 4
  • 36
  • 51
0

For unsigned integers you have ushort, uint and ulong, which is the equivalent to unsigned int16, unsigned int32 and unsigned int64 respectively.

aiko
  • 423
  • 1
  • 4
  • 11