Leaders snarfblam Posted August 31, 2004 Leaders Posted August 31, 2004 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. Quote [sIGPIC]e[/sIGPIC]
*Experts* Nerseus Posted August 31, 2004 *Experts* Posted August 31, 2004 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 Quote "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
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.