0% found this document useful (0 votes)
47 views9 pages

Structures and Enumerations

Uploaded by

alisakhi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views9 pages

Structures and Enumerations

Uploaded by

alisakhi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Programming C# 2.0, 3.0, 4.

Muhammed Ali Sakhi


Microsoft Certified Trainer

© PakDev.net
Agenda
Creating and Using Enumerations

Creating and Using Structures

© 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

Cannot have a parameter less constructor

Cannot have a finalizer

© PakDev.net
Enumerations and Structures

Demo

© PakDev.net
Demonstration Steps
Create an enum called Designation

Create and Use Employee struct

© PakDev.net
Thank you
PakDev.net

© PakDev.net

You might also like