Monday, June 20, 2016

Xml to Model in MVC


 XmlDocument doc = new XmlDocument();
 string path = AppDomain.CurrentDomain.BaseDirectory +  @"\Uploads\Process\" + filename;c var serializer = new  XmlSerializer(typeof(ModelName));
 var processData = XDocument.Load(path);
 FileStream loadStream = new FileStream(path, FileMode.Open,  FileAccess.Read);
 ProcessControlModel loadedObject =  (ModelName)serializer.Deserialize(loadStream);
 loadStream.Close();

No comments:

Post a Comment

Comments

Search

Custom Search
Protected by Copyscape Plagiarism Software