I want to create a xml file where I want want to write the database data. I've created a EF object for database to get the database data. Here is my code....
XmlSerializer xmlUser = new XmlSerializer(typeof(User));
TextWriter xmlUserWriter = new StreamWriter(@"C:\User.xml");
xmlUser.Serialize(xmlUserWriter, xmlUser);
But when I run this code Its show an error "InvalidOperationException" I've find out why this error occurred. This error occurred because xmlSerializer wants the User class public. Now I don't know how to solve this problem or how I can write the data into a xml file using EF object or any other option for using List. Can any one help me please. Thanks in advance.
No comments:
Post a Comment