How to type caste IEnumerable to an object list using lameda expression and foreach loop

           List o1= new List();
           var output = db.TaxOnProduct("Chai", 2, "Beverages").ToList();
           List o1 = output.Select(x => new Output { CategoryName = x.CategoryName.ToString(), ProductName = x.ProductName, TotalAmountAfterTax = x.TotalAmountAfterTax, TotalBeforeAfterTax = x.TotalBeforeAfterTax }).ToList();
           foreach (var test in output)
               Output objoutput= new Output();
               objoutput.ProductName = test.ProductName;


i used entity frame work and get data using store procedure then used lameda expression to put output in list of object

No comments: