27 lines
792 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Reflection;
namespace XMLExtractor
{
public class Nota
{
public string indice { get; set; }
public string valore { get; set; }
public static List<Nota> getNote (XmlNode attr){
List<Nota> noteList = new List<Nota>();
foreach (XmlNode row in attr.ChildNodes) {
Nota nota = new Nota();
PropertyInfo propertyInfoNota = nota.GetType().GetProperty(row.FirstChild.Name);
propertyInfoNota.SetValue(nota, Convert.ChangeType(row.InnerText, propertyInfoNota.PropertyType), null);
noteList.Add(nota);
}
return noteList;
}
}
}