在Linq中将int转换为String时遇到的问题
var items = from c in contacts select new ListItem
{
Value = c.ContactId, //Cannot implicitly convert type 'int' (ContactId) to 'string' (Value).
Text = c.Name
};var items = from c in contacts select new ListItem
{
Value = c.ContactId.ToString(), //Throws exception: ToString is not supported in linq to entities.
Text = c.Name
};
慕沐林林
qq_花开花谢_0
随时随地看视频慕课网APP
相关分类