I am trying to create object of some class inside the Linq query but gives me an error as set title of the question.
My query is:
List<oneViewModel> workOrderInfoList = (from abc in db.ABC
join customer in db.Customers on abc.CustomerId equals customer.CustomerId into customers
select new oneViewModel()
{
CustomerId = abc.CustomerId,
OrderNumber = workOrderInfo.OrderNumber,
OrderDate = abc.OrderDate,
SecondClassList = new List<SecondClass>(),
}).ToList();
I have define the list of class in as object inside oneViewModel.
public class ABC
{
public DateTime? WorkOrderDate { get; set; }
public long CustomerId { get; set; }
public string CustomerName { get; set; }
public List<SecondClass> SecondClassList { get; set; }
}