2

I need to be able to wrap a primitive data type. But I'm not sure how to proceed. The using clause (as below) works fine if its only for one file, but I need to be able to use it in my whole project.

Eg.

using int8_t = System.SByte;
using uint8_t = System.Byte;
using int16_t = System.Int16;
using uint16_t = System.UInt16;

Any help would be greatly appreciated.

Updated from comments:

We are using Enterprise Architect to generate our code (C#, C++, Java). And we need the code bases to be the same. So we need to be able to wrap the base types to be able to do that. With C/C++ is easy, we just use "typedef short int16_t;". But I need to be able to do it in C# as well.

Jack B Nimble
  • 5,039
  • 4
  • 40
  • 62
nosuch
  • 41
  • 6
  • 1
    What do you mean by wrapping a primitive type? What problem are you trying to solve? – BoltClock May 11 '11 at 12:20
  • We are using Enterprise Architect to generate our code (C#, C++, Java). And we need the code bases to be the same. So we need to be able to wrap the base types to be able to do that. With C/C++ is easy, we just use "typedef short int16_t;". But i need to be able to do it in C# as well. – nosuch May 11 '11 at 12:24
  • Well the problem is that C# doesn't have a `typedef` equivalent (http://stackoverflow.com/questions/161477/equivalent-of-typedef-in-c). It'd be a bit difficult... – BoltClock May 11 '11 at 12:25
  • Yup, and that why i need to wrap the base type. Then i would be able to do it. – nosuch May 11 '11 at 12:45

0 Answers0