Problema com a conversão de int para string no Linq para entidades
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
};
Existe alguma maneira eu posso conseguir isso? Note que no VB.NET não há problema em usar o primeiro trecho que funciona simplesmente ótimo, o VB é flexível, não consigo me acostumar com o rigor do C # !!!