calling list<pc> _pclist = new list<pc>(); ...add pc pclist.. writexml<list<pc>>(_pclist, "ss.xml"); function public static void writexml<t>(t o, string filename) { string filepath= environment.getfolderpath(environment.specialfolder.applicationdata) + "\\genweb2\\adsnopper\\" + filename; xmldocument xmldoc = new xmldocument(); xpathnavigator nav = xmldoc.createnavigator(); using (xmlwriter writer = nav.appendchild()) { xmlserializer ser = new xmlserializer(typeof(list<t>), new xmlrootattribute("therootelementname")); ser.serialize(writer, o); // error } file.writealltext(filepath,xmldoc.innerxml); } inner exception unable cast object of type 'system.collections.generic.list 1[pc]' type 'system.collections.generic.list 1[system.collections.generic.list`1[pc]]'. please help the problem line xmlserializer ser = new xmlserializ...
Comments
Post a Comment