HI folks
I have to populate the List for that I write following code
public class Teste
{
private List<PESSOA_CARRO_MARCA> _lista;
public List<PESSOA_CARRO_MARCA> RetornaTeste()
{
var mgr = new EntitiesTeste();
var query = mgr.PESSOA_CARRO_MARCA.OrderBy(f=>f.DESCRICAO);
query.ExecuteAsync(op =>
{
if (op.IsCompleted)
{
_lista = new List<PESSOA_CARRO_MARCA>();
foreach (var item in query)
{
_lista.Add(new PESSOA_CARRO_MARCA() { DESCRICAO= item.DESCRICAO, ATIVO= item.ATIVO});
}
return _lista; >>>> Here is error
}
});
}
But Ideablade gives me error
(1) System.Action<IdeaBlade.EntityModel.EntityQueryOperation> returns void,a return keyword
must not be followed by an object expression.
(2)Cannot convert lambda expression to delegate type 'System.Action<IdeaBlade.EntityModel.EntityQueryOperation>'
because some of the return types in the block are not implicitly convertible to the delegate return type)
If we put return _lista at end of mehtod its compiling but throwing run time exception .
Object reference not set to an instance of an object.
Thanks
How can I solve this problem