typedef in c#?

H

Hyun-jik Bae

is there any substitution for

typedef int MyType;

in C#?

Please reply. Thanks in advance.

Hyun-jik Bae
 
M

Marc Gravell

Not really;

In 2.0, you can (on a file-by-file basis) use an alias - however this is
ONLY a compile-time alias (intended to simplify conflicting name
resolution); there will not be an actual type.

using MyType=System.Int32;

Note that it doesn't support the pointer and array aspects of the "C"
typedef

Marc
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Hyun-jik Bae said:
is there any substitution for

typedef int MyType;

in C#?

No.

And it is a rather toothless feature in C/C++
since it is only aliasing not creating new
types like in the Pascal/Ada familiy of languages.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top