c# - How return Tuple<T1,T2> -
i create method anonymous types. want return tuple. how implement this?
public ienumerable<tuple<t1, t2, t3>> getfiles() { using (testentities context = new testentities()) { var query = pf in context.t1 join pfext in context.t2 on pf.id equals pfext.processedfilesid join st in context.t3 on pfext.wfstatusid equals st.wfstatusid select new { pf.id, pf.recordcount, pf.name, pfext.packageid, statusname = st.name, pfext.protocolstatus }; } }
something following should work:
public ienumerable<tuple<t1, t2, t3>> getfiles() { using (testentities context = new testentities()) { var query = pf in context.t1 join pfext in context.t2 on pf.id equals pfext.processedfilesid join st in context.t3 on pfext.wfstatusid equals st.wfstatusid select new { pf, pfext, st }; return query.asenumerable() .select(x => tuple.create(x.pf, x.pfext, x.st)); } }
Comments
Post a Comment