Structures and Enumerations
Structures and Enumerations
© PakDev.net
Agenda
Creating and Using Enumerations
© PakDev.net
Enumerations
Convenient to create a set of symbolic names
enum Designation
{
Manger,
Grunt,
Contractor,
Vice President
{
© PakDev.net
Enumerations
By default storage type is System.Int32
You can change the type
enum Designation : byte
{
….
{
Use Enum.GetUnderlyingType(typeof(…))
method
© PakDev.net
Structures
Defined by struct keyword
They contain any number of data fields and
methods
Point P1;
P1.x = 10;
P1.y = 10;
P1.Increment();
Call the default constructor to set the fields to
their default values
© PakDev.net
Structure Limitations
The cannot inherit or be inherited
© PakDev.net
Enumerations and Structures
Demo
© PakDev.net
Demonstration Steps
Create an enum called Designation
© PakDev.net
Thank you
PakDev.net
© PakDev.net