I have the following enum
public enum Outcome
{
DontKnow = 0,
Good = 1,
Bad = 2,
NotBad = 3
}
In my Results class, I have a property with this enum:
public class Result
{
public int Id { get; set; }
public string Name { get; set; }
public Outcome FinalOutcome { get; set; }
}
As I read data from the database -- using SqlDataReader -- how do I assign its value?
while(reader.Read())
{
Id = Convert.IsDbNull(reader[0]) ? Convert.ToInt32(0) : Convert.ToInt32(reader[0]);
Name = Convert.IsDbNull(reader[1]) ? string.Empty : reader[1].ToString();
FinalOutcome = Convert.IsDbNull(reader[2]) ? WhatGoesHere? : WhatGoesHere?;
}