Jump to content
Xtreme .Net Talk

Recommended Posts

  • Leaders
Posted

To quote the help files included with studio.net: "Class Enum is derived from class ValueType; that is, Enum is itself a reference type, not a value type."

 

Is this saying that instances of enumerations are reference types... meaning that they come from the heap instead of living in the stack and that they have more overhead?

 

I was always under the impression that an enumeration was ultimately treated as it's underlying intrinsic data type and therefore a value type. I hope I am misreading this sentance and that I am not wrong.

[sIGPIC]e[/sIGPIC]
  • *Experts*
Posted

That part is a bit confusing. To put it briefly, without thinking too much, when you declare an instance of an enum, you get a value type. That means it can be copied on assignment, it defaults to being passed by value (vs. reference), and the memory allocation is the same.

 

As the help points out, each languague provides its own specific way of creating an "enum type", which is a value type.

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...