typedef

  • Thread starter Thread starter ononak
  • Start date Start date
O

ononak

Hello,

I am looking for the type C++ typedef equivalent in C#. Unfortunately,
I couldn't find anything except using directive. Exp:

using myId = int;

However, this myId is only accessible in the file which is defined.
Bu, I want to use myId type also in another files without redefining.

Any help would be greatly appreciated.
 
I am looking for the type C++ typedef equivalent in C#. Unfortunately,
I couldn't find anything except using directive. Exp:

using myId = int;

However, this myId is only accessible in the file which is defined.
Bu, I want to use myId type also in another files without redefining.

Any help would be greatly appreciated.

No, there's no way of doing this. You could always create your own
struct which *contains* an int, of course. If you're trying to use it
as an identifier type, that would make a lot of sense, as a lot of
integer operations really don't make sense on identifiers. What does
it mean to divide one identifier by another, for example?

Jon
 
Back
Top