c# - accesing the value of properties using reflection -


i have object , want write , xml element each property in object , value string in middle:

system.type type = cabecera.gettype();         system.reflection.propertyinfo[] propiedades = type.getproperties();          xml.writestartdocument();         xml.writestartelement("factura");             xml.writestartelement("cabfac"); //inicio de cabecera              // imprime inicio valor y fin de elemento por cada propiedad del objeto             foreach (system.reflection.propertyinfo propiedad in propiedades)              {                 xml.writestartelement(propiedad.name);                  xml.writestring("value"); // here problem                 xml.writeendelement();             }               xml.writeendelement(); //fin de factura         xml.writeenddocument();         xml.close(); 

how can change "value" propiedad.value x)

try:

xml.writestring(propiedad.getvalue(cabecera, null).tostring()); 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -