defining a simple type

  • Thread starter Thread starter Donnie Fuqua
  • Start date Start date
D

Donnie Fuqua

Can anyone tell me if there is a way in C# to do what typedef or #define
could do
in Visual C++?

I want to do something like:
#ifdef SMALL
typedef ushort APPUINT;
#else
typedef ulong APPUINT;
#endif

This way I can have a configuration where I just use /define SMALL to get a
copy that
can't handle large data sets, but has a smaller memory footprint. (It's a
neural network.)

Any help is appreciated.

Donnie Fuqua
(e-mail address removed)
 
Donnie Fuqua said:
Can anyone tell me if there is a way in C# to do what typedef or #define
could do in Visual C++?

I want to do something like:
#ifdef SMALL
typedef ushort APPUINT;
#else
typedef ulong APPUINT;
#endif

This way I can have a configuration where I just use /define SMALL to
get a copy that can't handle large data sets, but has a smaller
memory footprint. (It's a neural network.)

Any help is appreciated.

You can't, I'm afraid. (Of course, you could run your C# code through a
C/C++ preprocessor, with a bit of work.) One alternative would be to
define a struct APPUINT which either had implicit conversions to/from
ushort or implicit conversions to/from ulong, depending on SMALL. I
don't know what the performance implications of that would be like
though...
 
Back
Top