Click here to Skip to main content
15,893,564 members
Home / Discussions / C#
   

C#

 
GeneralRe: enum question Pin
Mikke_x2-Jul-04 12:49
Mikke_x2-Jul-04 12:49 
GeneralRe: enum question Pin
Colin Angus Mackay2-Jul-04 13:57
Colin Angus Mackay2-Jul-04 13:57 
GeneralRe: enum question Pin
Werdna2-Jul-04 14:38
Werdna2-Jul-04 14:38 
GeneralRe: enum question Pin
Colin Angus Mackay2-Jul-04 14:52
Colin Angus Mackay2-Jul-04 14:52 
GeneralRe: enum question Pin
Werdna2-Jul-04 15:06
Werdna2-Jul-04 15:06 
GeneralRe: enum question Pin
Colin Angus Mackay2-Jul-04 15:19
Colin Angus Mackay2-Jul-04 15:19 
GeneralRe: enum question Pin
Mikke_x3-Jul-04 0:33
Mikke_x3-Jul-04 0:33 
GeneralRe: enum question Pin
Colin Angus Mackay3-Jul-04 12:08
Colin Angus Mackay3-Jul-04 12:08 
Mikke_x wrote:
Yeah, I see what you mean. But I still can´t see the point of beeng able to declare an enum as:
enum ints :int {zero, one} if I can´t use it as constant int without convert


The explicit cast is a safety mechanism - no matter how good your comments are you are not going to force someone to read them unless they have to. Most people muddle along all through their lives, programmers included. They only tend to look for something if they need to. The compiler forces them to need to.

The enum is there to say here is a type that can contain a set of possible values. If you want to assign it to an integer the compiler makes you explicity cast it to an integer (it probably does nothing when compiled - I've never checked the IL for that) because it is ensuring that you are fully aware that what you are doing is stripping off the protective layer that the enum is providing around the underlying int.


"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar

The Second EuroCPian Event will be in Brussels on the 4th of September

Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!

My Blog


GeneralDatagrid Question Pin
C#Coder672-Jul-04 5:42
C#Coder672-Jul-04 5:42 
GeneralRe: Datagrid Question Pin
DougW482-Jul-04 6:57
DougW482-Jul-04 6:57 
GeneralMultiple instance of startup form Pin
Anonymous2-Jul-04 4:09
Anonymous2-Jul-04 4:09 
GeneralRe: Multiple instance of startup form Pin
Dave Kreskowiak2-Jul-04 4:57
mveDave Kreskowiak2-Jul-04 4:57 
GeneralRe: Multiple instance of startup form Pin
Anonymous2-Jul-04 5:32
Anonymous2-Jul-04 5:32 
GeneralRe: Multiple instance of startup form Pin
Dave Kreskowiak2-Jul-04 5:50
mveDave Kreskowiak2-Jul-04 5:50 
GeneralRe: Multiple instance of startup form Pin
Andreas X3-Jul-04 22:01
professionalAndreas X3-Jul-04 22:01 
GeneralOne port: multiple transfer Pin
Gimpy19832-Jul-04 4:08
Gimpy19832-Jul-04 4:08 
Generalinstall project paths Pin
mcgahanfl2-Jul-04 4:07
mcgahanfl2-Jul-04 4:07 
GeneralPlease see this Pin
saud_a_k2-Jul-04 1:31
saud_a_k2-Jul-04 1:31 
GeneralRe: Please see this Pin
Colin Angus Mackay2-Jul-04 2:10
Colin Angus Mackay2-Jul-04 2:10 
GeneralRe: Please see this Pin
saud_a_k2-Jul-04 2:48
saud_a_k2-Jul-04 2:48 
GeneralRe: Please see this Pin
Gary Thom2-Jul-04 2:29
Gary Thom2-Jul-04 2:29 
GeneralRe: Please see this Pin
saud_a_k2-Jul-04 2:41
saud_a_k2-Jul-04 2:41 
GeneralUsing the same currency manager more than once Pin
WillemM2-Jul-04 1:17
WillemM2-Jul-04 1:17 
GeneralRe: Using the same currency manager more than once Pin
Heath Stewart2-Jul-04 3:08
protectorHeath Stewart2-Jul-04 3:08 
GeneralRe: Using the same currency manager more than once Pin
WillemM2-Jul-04 3:47
WillemM2-Jul-04 3:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.