I found a code snippet of the following form:
public static Expression<Func<Invoice, CustomerContact>> GetCustomerContact() { return i => new CustomerContact { FirstName = i.Customer.FirstName, LastName = i.Customer.LastName, Email = i.Customer.Email, TelMobile = i.Customer.TelMobile, }; }
In other parts of the code, I want to get the same easy CustomerContact object, not just from the invoice, but from the client itself. Therefore, it is obvious that you need to do the following:
public static Expression<Func<Customer, CustomerContact>> GetCustomerContact() { return c => new CustomerContact { FirstName = c.FirstName, LastName = c.LastName, Email = c.Email, TelMobile = c.TelMobile, }; }
and then change Expression to input Invoice to the input to access this method, i.e. something like this:
public static Expression<Func<Invoice, CustomerContact>> GetCustomerContact() { return i => GetCustomerContact(i.Customer);
What is the correct syntax for this?
source share