---
title: "How to set the value of an enumeration?"  
description: "How to set the value of an enumeration?"  
author: "Anonymous User"  
published: 2014-09-29  
updated: 2014-09-29  
canonical: https://www.mindstick.com/forum/2277/how-to-set-the-value-of-an-enumeration  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How to set the value of an enumeration?

i have a [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) setting the [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) od an [enumeration](https://www.mindstick.com/blog/88/enumeration-in-c-sharp).

In my [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) I [define](https://yourviews.mindstick.com/audio/1110/lifestyles-choices-that-define-our-lives) this enumeration:

```
    public enum PartType    {        Application,        Operating_System,        Hardware    }     public PartType Part { get; set; }
```

Then, in the same [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) I try to set a value of this eumeration in this way (how I have read on the C# [documentation](https://answers.mindstick.com/qa/30462/what-is-documentation)):

```
   if (row["part"] == "a")   {        Part.Application;   }
```

But it signed as error. Why? What am I [missing](https://answers.mindstick.com/qa/52138/international-missing-children-s-day-2019-was-observed-on)? How can I solve?

## Replies

### Reply by Sumit Kesarwani

Hi goti, \

It should be :

Part = PartType.Application;


---

Original Source: https://www.mindstick.com/forum/2277/how-to-set-the-value-of-an-enumeration

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
