B
B
BadCats2016-02-17 21:21:17
C++ / C#
BadCats, 2016-02-17 21:21:17

Aliases (aliases) in enums - usage rules (c#)?

Hello! I'm currently learning enums in c# and wanted to ask why in c# you can use an alias for any integer data type
(byte, sbyte, short, ushort, int, uint, long, ulong) but you can't
use any C# system integer data type (Byte , SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64) ?
When I watched the video tutorial, there was such an example-explanation: "Imagine a situation in which you might want to abandon the Frameworks provided by Microsoft in the c # language and disable the import of all libraries, including the import of the System library, and decide to create you can create your own types? Of course, yes, but at the same time you should have the simplest data types. So, you will still have the simplest data types (even with the System library disabled), but not in the form of a full-fledged structure (for example, byte) that is included in the System namespace. ". Why, with such a detailed description of the situation, I ask all this? The fact,
Here is my question: Are there any other reasons (besides the above example) why aliases (aliases) are used in enums?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kovalsky, 2016-02-17
@dmitryKovalskiy

I read and think about the delirium of a madman who smoked a harsh joint and picked up a book on programming.
Whose is that? Take it and use it. Or do you want to use these words as values ​​for an enum type?
These are not types. This is an alias for the types in the first quote. The System namespace and all that.
Reformulate the question somehow, because it is extremely difficult for me personally to understand this mess. In short - 1) what you want to do, 2) What is stopping you.
UPD: aee052c5df4c4389b80f3d4e0954bf29.PNG
For some reason, no one bothers me to write as you showed. Everything is running great

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question