Home > DeveloperSection > Forums > How to set the value of an enumeration?
Goti Bandu

Total Post:119

Points:835
Posted on    September-29-2014 12:34 AM

 C# C# 
Ratings:


 1 Reply(s)
 535  View(s)
Rate this:

i have a problem setting the value od an enumeration.

 

In my code I define this enumeration:

 

    public enum PartType

    {

        Application,

        Operating_System,

        Hardware

    }

 

    public PartType Part { get; set; }

Then, in the same class I try to set a value of this eumeration in this way (how I have read on the C# documentation):

 

   if (row["part"] == "a")

   {

        Part.Application;

   }

But it signed as error. Why? What am I missing? How can I solve?



Sumit Kesarwani

Total Post:378

Points:2694
Posted on    September-29-2014 12:58 AM

Hi goti, 

It should be :

Part = PartType.Application;


Don't want to miss updates? Please click the below button!

Follow MindStick