.net - How to combine lists into single data entity in c# -
i have web method in c# web service creates 3 lists, filled xml input. want combine these 3 lists 1 entity (a dataset best, ios app consuming web service programmed accept , parse datasets), , return them web method.
here code looks like:
[webmethod] public dataset selectobjects(string externalid, string password) { dataset ds = new dataset(); membershipauthservicereference.membershipauthenticationservice objservice = new membershipauthservicereference.membershipauthenticationservice(); membershipauthservicereference.soapheadercredentials objsoapheader = new membershipauthservicereference.soapheadercredentials(); membershipauthservicereference.memberuserinfo objmemberinfo = new membershipauthservicereference.memberuserinfo(); try { objsoapheader.username = externalid; objsoapheader.password = password; objmemberinfo = objservice.getmembershipinfo(); list<obj1> listobj1 = new list<obj1>(); (int = 0; < objmemberinfo.obj1.length; i++) { obj1 obj_obj1 = new obj1(); obj_obj1.stuff = objmemberinfo.obj1[i].stuff.tostring(); listobj1.add(obj_obj1); } list<obj2> listobj2 = new list<obj2>(); (int = 0; < objmemberinfo.obj2.length; i++) { obj2 obj_obj2 = new obj2(); obj_obj2.stuff = objmemberinfo.obj2[i].stuff.tostring(); listobj2.add(obj_obj2); } list<obj3> listobj3 = new list<obj3>(); (int = 0; < objmemberinfo.obj3.length; i++) { obj3 obj_obj3 = new obj3(); obj_obj3.stuff = objmemberinfo.obj3[i].stuff.tostring(); listobj3.add(obj_obj3); } } catch (exception ex) { string serror; serror = ex.message.tostring(); } return ds; }
how combine these lists dataset? i'm assuming it's possible? if not, there viable alternative same thing?
first concatenate lists shown below , use link generate dataset
var combinedlist= listobj1.concat(listobj2).concat(listobj3);
Comments
Post a Comment