我写了一个 LINQ 查询子句,但是出现了一个错误。任何人都可以帮助我。在此先感谢:
list = (from cr in dt.AsEnumerable()
select new Cards
{
MemberNumber = cr.Field<string>("MemberNumber"),
if( cr.Field<int>("CardState")==0)
{
CardState ="aaa";
}
if( cr.Field<int>("CardState")==1)
{
CardState ="bbb";
}
if( cr.Field<int>("CardState")==2)
{
CardState ="ccc";
}
if( cr.Field<int>("CardState")==3)
{
CardState ="ddd";
}
if( cr.Field<int>("CardState")==4)
{
CardState ="eee";
}
}).ToList<Cards>();