471,350 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

enum types

I read on MSDN that enum is a ref type

http://msdn.microsoft.com/library/de...classtopic.asp
but in one of the MS publications enum is said to be a value type. (ISBN:
0-7356-1289-7 page:165)

what is enum? I am confused.

Thanks.
Dec 7 '05 #1
4 1332
Pohihihi wrote:
I read on MSDN that enum is a ref type

http://msdn.microsoft.com/library/de...classtopic.asp
but in one of the MS publications enum is said to be a value type. (ISBN:
0-7356-1289-7 page:165)

what is enum? I am confused.


Enum itself is a reference type, but the types derived from it are
value types.

(ValueType itself is a reference type too.)

Jon

Dec 7 '05 #2
so in
enum MyEnum { one, two, three }

'MyEnum' is a ref type but in

MyEnum a = MyEnum.one

'a' is a value type?


"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Pohihihi wrote:
I read on MSDN that enum is a ref type

http://msdn.microsoft.com/library/de...classtopic.asp
but in one of the MS publications enum is said to be a value type. (ISBN:
0-7356-1289-7 page:165)

what is enum? I am confused.


Enum itself is a reference type, but the types derived from it are
value types.

(ValueType itself is a reference type too.)

Jon

Dec 7 '05 #3
Pohihihi wrote:
so in
enum MyEnum { one, two, three }

'MyEnum' is a ref type but in

MyEnum a = MyEnum.one

'a' is a value type?


No, 'a' is a variable. MyEnum is a value type, but System.Enum is a
reference type.

Jon

Dec 7 '05 #4
thx.

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Pohihihi wrote:
so in
enum MyEnum { one, two, three }

'MyEnum' is a ref type but in

MyEnum a = MyEnum.one

'a' is a value type?


No, 'a' is a variable. MyEnum is a value type, but System.Enum is a
reference type.

Jon

Dec 7 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Alexander Grigoriev | last post: by
4 posts views Thread by slot | last post: by
reply views Thread by Vaclav Haisman | last post: by
18 posts views Thread by Nebula | last post: by
4 posts views Thread by Nikhil Patel | last post: by
21 posts views Thread by Andreas Huber | last post: by
31 posts views Thread by Michael C | last post: by
34 posts views Thread by Steven Nagy | last post: by
12 posts views Thread by Cmtk Software | last post: by
3 posts views Thread by hufaunder | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.