MyITBlog.com - IT Professionals Online Journal
 
  Home  |   Site News  |   About Us  |   Privacy  |   FAQ  |   Contact   Add Blog Entry  |  Login  |  Register   
   HOME  >  Programming

All about Enum and sample code snippet for binding enum to a combo box
by praveen on 15 Nov 2005, 05:26
Total Hits: 632    Comments: 0   Votes: 0
Category: Programming     

An Enum is a structure extending ValueType and not a Class. It not explicitly created on the heap memory.

Instead, it is a field within a Class and exist temporarily on the stack as a local variable. The cost of an Enum is typically 4 bytes. This is due to 32-bit word alignment.

 

Code Snippet to bind enum to a combo box

 

string[] enumString= Enum.GetNames(typeof(MyEnum));

 

foreach(string s in enumString)

{

comboBox1.Items.Add(s);

}

 

 

 

Happy coding !

:)

Praveen