I am trying to get optionset value of a picklist with the code below to execute some functions. It's not working, can anyone tell me correct syntax and library to use:
OptionSetValue stateType = (OptionSetValue)entity.Attributes["new_status"];
if (stateType.value == 2)
{
//Execute code
}