You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
747 B
32 lines
747 B
7 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Threading.Tasks;
|
||
|
using System.Windows.Forms;
|
||
|
using System.Xml.Serialization;
|
||
|
using System.Xml;
|
||
|
using System.IO;
|
||
|
|
||
|
namespace xmlDeserWin
|
||
|
{
|
||
|
class Parser
|
||
|
{
|
||
|
public IEnumerable<User> Deser()
|
||
|
{
|
||
|
List<User> users;
|
||
|
using (var reader = new StreamReader("fileXML.xml"))
|
||
|
{
|
||
|
if (reader == null)
|
||
|
return null;
|
||
|
XmlSerializer deserializer = new XmlSerializer(typeof(List<User>),
|
||
|
new XmlRootAttribute("user_list"));
|
||
|
users = (List<User>)deserializer.Deserialize(reader);
|
||
|
|
||
|
return users;
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|