So I have this query:
using (APContext _context = new APContext(null)) {
                var q = from inv in _context.Invoices
                        where inv.Sys_InvoiceID == 1276291
                        join cust in _context.InvoiceCustomFields
                        on inv.Sys_InvoiceID equals cust.FK_SysInvoiceID
                        select new {
                                inv.Sys_InvoiceID,
                                inv.AccountNumber,
                                cust.FK_CustomFieldHeader,
                                cust.Value
                        };
            }
Which returns something like so { 1, 50, "Badger", "Is Great"}, { 2, 51, "Cat", "Is Cool"}
So I have two items in a list(shown above) and I need to use both FK_CustomFieldHeaders values as properties in an anonymous list like so:
      var x = q.Select(r => new{
                    ID = r.Sys_InvoiceID,
                    AccountNum = r.AccountNumber,
                    //Loop here and use reflectionto set CustomFieldHeader value as the property name and cust.Value to be the value for the property
        });
How do I do this?
EDIT: My question is different because I'm not talking about setting one property here. The query returns two. Check the update.
EDIT 2: It doesn't have to be reflection. I'd just like some help and explanation please.
