>> public class dataitem >> { >> public int custno { get; set; } >> public string company { get; set; } >> public string phone { get; set; } >> public string faxno { get; set; } >> >> public dataitem(int cno, string c, string p, string f) >> { >> custno = cno; >> company = c; >> phone = p; >> faxno = f; >> } >> } >>And then use that constructor in your select:
>> IEnumerable<dataitem> customers = from a in db.customers >> where SqlMethods.Like(a.custno,CustomerFilter) || SqlMethods.Like(a.company,CustomerFilter) >> orderby a.custno >> select new dataitem(a.custno, a.company, a.phone, a.faxno) ; >>Linq does create a new class for you when you do a select, but it only has local scope so it's not very useful.
> IQueryable<customer_source> CustomerList = from a in > (from p in db.job_info > join c in db.customers on p.cust_num equals c.custno > where p.status == 'A' > orderby c.company > select new { custno = c.custno, company = c.company } > ).Distinct() > orderby a.company > select new customer_source { custno = a.custno, company = a.company }; >>
> var CustomerList = from a in > (from p in db.job_info > join c in db.customers on p.cust_num equals c.custno > where p.status == 'A' > orderby c.company > select new { c.custno, c.company, c.phone, c.faxno } > ).Distinct() > orderby a.company > select a; >>
>> IEnumerable<customer> customers = from a in db.customers >> where SqlMethods.Like(a.custno,CustomerFilter) || SqlMethods.Like(a.company,CustomerFilter) >> orderby a.custno >> select a; >>>>
>> public class dataitem >> { >> public int custno { get; set; } >> public string company { get; set; } >> public string phone { get; set; } >> public string faxno { get; set; } >> >> public dataitem(int cno, string c, string p, string f) >> { >> custno = cno; >> company = c; >> phone = p; >> faxno = f; >> } >> } >>>>
>> IEnumerable<dataitem> customers = from a in db.customers >> where SqlMethods.Like(a.custno,CustomerFilter) || SqlMethods.Like(a.company,CustomerFilter) >> orderby a.custno >> select new dataitem(a.custno, a.company, a.phone, a.faxno) ; >>