Hola tengo unas clases que quiero que se combiertan sus estructuras en un
xml... hay algo que ya exista?
ejemplo:
public class ObjetoA
{
private int myVar = 500;
public int Valor
{
get { return myVar; }
set { myVar = value; }
}
private string name = "ObjetoA";
public string Name
{
get { return name; }
set { name = value; }
}
private ObjetoB b = new ObjetoB();
public ObjetoB B
{
get { return b; }
set { b = value; }
}
}
public class ObjetoB
{
private int valor = 500;
public int ValorB
{
get { return valor ; }
set { valor = value; }
}
private string name = "ObjetoB";
public string Nombre
{
get { return name; }
set { name = value; }
}
}
Ahora en xml:
<?xml version="1.0" encoding="utf-8" ?>
- <ObjetoA xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns="
http://tempuri.org/">
<Valor>500</Valor>
<Name>ObjetoA</Name>
- <B>
<ValorB>500</ValorB>
<Nombre>ObjetoB</Nombre>
</B>
</ObjetoA>
Gracias
Leer las respuestas