Is this what you're after; i.e. a way to have a run time display value for each enum value?
//initialise a dictionary to map your enum values to their runtime labels
IDictionary<RunInfoRequestType,string> labels = new Dictionary<RunInfoRequestType,string>
{
{ RunInfoRequestType.text1, RunInfoRequestType.text1.ToString() }
,{ RunInfoRequestType.text2, RunInfoRequestType.text2.ToString() }
,{ RunInfoRequestType.text3, RunInfoRequestType.text3.ToString() }
,{ RunInfoRequestType.text4, RunInfoRequestType.text4.ToString() }
,{ RunInfoRequestType.text5, RunInfoRequestType.text5.ToString() }
,{ RunInfoRequestType.text6, RunInfoRequestType.text6.ToString() }
,{ RunInfoRequestType.text7, RunInfoRequestType.text7.ToString() }
,{ RunInfoRequestType.text8, RunInfoRequestType.text8.ToString() }
};
//set text3 to string text
labels[RunInfoRequestType.text3] = text;
If so, the above will do it, but you may want to opt for a non-enum solution; e.g.
public class RunInfoRequestType
{
public int Id {get; private set;}
public string DisplayName {get; set;}
protected static readonly IDictionary<int,RunInfoRequestType> values = new Dictionary<int,RunInfoRequestType>();
protected RunInfoRequestType (int id, string displayName)
{
this.Id = id;
this.DisplayName = displayName;
values.Add(id, this);
}
public static readonly RunInfoRequestType Text1 = new RunInfoRequestType(1, "text1");
public static readonly RunInfoRequestType Text2 = new RunInfoRequestType(2, "text2");
public static readonly RunInfoRequestType Text3 = new RunInfoRequestType(3, "text3");
public static readonly RunInfoRequestType Text4 = new RunInfoRequestType(4, "text4");
public static readonly RunInfoRequestType Text5 = new RunInfoRequestType(5, "text5");
public static readonly RunInfoRequestType Text6 = new RunInfoRequestType(6, "text6");
public static readonly RunInfoRequestType Text7 = new RunInfoRequestType(7, "text7");
public static readonly RunInfoRequestType Text8 = new RunInfoRequestType(8, "text8");
public static implicit operator int(RunInfoRequestType runInfoRequestType)
{
return runInfoRequestType.Id;
}
public static implicit operator RunInfoRequestType(int id)
{
RunInfoRequestType runInfoRequestType ;
values.TryGetValue(id, out runInfoRequestType);
return runInfoRequestType ;
}
public override string ToString()
{
return this.DisplayName;
}
}
//set text3's display name to string text
RunInfoRequestType.Text3.DisplayName = text;