CCode = (int)Enum.Parse(typeof(EnumHere), cu.ToString())
Enum.Parse requires an enum type. You are parsing it an enumerable CList
UPDATE: User informs that CList is Enum.
ok - if
IEnumerable<clist> objApproverlist = objservice.GetCList(txtbox.Text);
is actually
IEnumerable<CList> objApproverlist = objservice.GetCList(txtbox.Text);
then you don't need that long winded way of getting the int:
var result = from CList cu in objApproverlist select new { CCode = (int)cu, CDescription = cu.ToString() };
But I have tested both ways and it works for me.
Please tell us all the types of the objects you're using
UPDATE 2:
My Test code:
public enum CList
{
a, b, c, d
}
private static void Main()
{
IEnumerable<CList> objApproverlist = Enum.GetValues(typeof(CList)).Cast<CList>().AsEnumerable();
var result = from CList cu in objApproverlist
select new {
CCode = (int)Enum.Parse(typeof(CList), cu.ToString()),
CDescription = cu.ToString() };
var tempValue = new { CCode = 0, CDescription = "-- Select --" };
var list = result.ToList();
list.Insert(0, tempValue);
list.ForEach(a =>
{
Console.WriteLine("{0}\t{1}", a.CCode, a.CDescription);
});
}
This works in both cases. I get the readout {0 a}, {1 b}, etc.