Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generic List .First not working LINQ

Tags:

c#

linq

        var stuff = ctx.spReport();
        var StuffAssembled = new List<ReportCLS>();
        var val = new List<ReportCLS>();
        foreach (var item in stuff)
        {
            StuffAssembled.Add(new ReportCLS(item));

        }

        val.Add(StuffAssembled.First());

Keeps throwing

System.Collections.Generic.List' does not contain a definition for 'First' and no extension method 'First' accepting a first argument of type 'System.Collections.Generic.List' could be found (are you missing a using directive or an assembly reference?)

what is going wrong ?

moreover how do i fix it?

Thanks

like image 961
MarkKGreenway Avatar asked Apr 23 '10 19:04

MarkKGreenway


1 Answers

you should add this to your using statements:

using System.Linq;
like image 178
Philippe Leybaert Avatar answered Oct 24 '22 16:10

Philippe Leybaert