typedef

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.
 
J

Jon Skeet [C# MVP]

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
 

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