How is enumerations are stored in memory?
I need an answer right now..so who all is seeing this if you know pls reply me..
Regards,
TeenzoneZ.
3 1050
hi,
If anyone knows how enumerations are stored in memory...
TeenzoneZ.
From Joe Duffy's Professional .NET Framework 2.0 (buy the book, it's great!):
An enumeration (a.k.a. enum) is a special type that maps a set of names to numeric values. Using them is an alternative to embedding constants in your code and provides a higher level of nominal type safety. Enum types look much like ordinary types in metadata, although they abide by a strict set of rules as defined in the CTS. For example, defining methods or constructors on enum types is prohibited, as is implementing interfaces, and they can only have a single field to represent the value. The rules exist so that enums are performant and so languages can treat them in a certain manner. Thankfully, most languages have syntactic support to abstract these rules away (C# included).
An enum type itself derives from System.Enum, which itself derives from System.ValueType. Each is backed by a specific primitive data type, one of Boolean, Char, Byte, Int16, Int32, Int64, SByte, UInt16, UInt32, UInt64, IntPtr, UIntPtr, Single, and Double. Int32 is used as the default in most languages; it provides a good compromise between storage and capability to extend the enum in the future to support more and more values.
An instance of a given enum contains a single field representing its value. Because enums are value types, having an instance of one is essentially the same as having a value of its backing store type, except that you can refer to it by type name, and they can be coerced back and forth rather simply.
Hi
Thanks
Regards,
TeenzoneZ
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Joyce |
last post by:
In my schema I have 2 enumerations, let's say, country description and
country code, and I want to use them so I can map each country
description to its precise country code (and no other).
So far...
|
by: Plinkerton |
last post by:
I'm making an Base Class that will be inherited. In my base class, I
have a public enumeration that defines a list of things I want my class
to be able to do. I use it for Method input...
|
by: Christopher Benson-Manica |
last post by:
I'll try to explain what I want to do:
I have foo.h and foo.cpp. Units that include foo.h will define an
enumeration bar:
enum bar { typeNone, typeBaz, typeQuux, ... , count };
A method...
|
by: JoeH |
last post by:
Hi,
I'm using a COM DLL (created in VB) in my javascript code and can
successfully call its methods and get/set its properties. There are
also some Public enumerations defined in the ActiveX...
|
by: Seamus M |
last post by:
I can't find any info on enumerations in the PHP manual, so I assume there
is no built in way to create them. Can anyone tell me the best way to build
a simple enumeration, such as:
Enum...
|
by: someone else |
last post by:
I have some code that creates dynamic enumerations for use in a PropertyGrid
control. This all works perfectly but the memory usage of the program
increases quite quicly when viewing the...
|
by: Oleg Ogurok |
last post by:
Hi all,
I've added a new DataSet (xsd file) to my project in VS.NET 2003.
There I create a simple type as an enumeration of values.
<xs:simpleType name="MyCustomType">
<xs:restriction...
|
by: ChrisB |
last post by:
Hello:
I will be creating 50+ enumerations related to a large number of classes
that span a number of namespaces. I was wondering if there are any "best
practices" when defining enumerations.
...
|
by: Ben Finney |
last post by:
Antoon Pardon wrote:
> I just downloaded your enum module for python
> and played a bit with it. IMO some of the behaviour makes it less
> usefull.
Feedback is appreciated. I'm hoping to...
|
by: Ben Finney |
last post by:
Howdy all,
PEP 354: Enumerations in Python has been accepted as a draft PEP. The
current version can be viewed online:
<URL:http://www.python.org/peps/pep-0354.html>
Here is the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |