c# - getting error while serializing an object list -


i receive error invoking method on button click event handler:

system.runtime.serialization.invaliddatacontractexception' occurred in mscorlib.dll not handled in user code

this handler:

private async task writeasync()          {             var objectgraph = getobjectgraph();            var serializer = new  datacontractserializer(typeof(list<car>));             using (var stream = await applicationdata.current.localfolder.openstreamforwriteasync(myfile, creationcollisionoption.replaceexisting))              {                 serializer.writeobject(stream, objectgraph);             }             txt.text = "write succeed !!!";         } 

look examples datacontractserializer here: msdn


Comments