Hola, buen día!!
Tengo tres clases:
Código C++:
Ver originalpublic partial class Comprobante
{
private ClasePersona _persona;
private string _carrera;
public string Carrera
{
get
{
return this._carrera;
}
set
{
this._carrera = value;
}
}
public ClasePersona Persona
{
get
{
return this._persona;
}
set
{
this._persona= value;
}
}
}
public partial class ClasePersona
{
private ClaseDomicilio _domicilio;
private string _dato;
public ClaseDomicilio DomicilioFiscal
{
get
{
return this._domicilio;
}
set
{
this._domicilio = value;
}
}
public string Dato
{
get
{
return this._dato;
}
set
{
this._dato = value;
}
}
}
public partial class ClaseDomicilio
{
private string _calle;
private string _noExterior;
private string _noInterior;
public string Calle
{
get
{
return this._calle;
}
set
{
this._calle = value;
}
}
public string NoExterior
{
get
{
return this._noExterior;
}
set
{
this._noExterior = value;
}
}
public string NoInterior
{
get
{
return this._noInterior;
}
set
{
this._noInterior = value;
}
}
}
y quiero acceder a ellos mediante Reflection y cambiar el valor de sus propiedades mediante el SET, pero me lanza este error:
El objeto de tipo 'System.String' no puede convertirse en el tipo 'Comprobante'.
las lineas de mi codigo son:
Código C++:
Ver originalComprobante comprobante = new Comprobante();
Type tipo = comprobante.GetType();
PropertyInfo propiedad = tipo.GetProperty(strNombrePropiedad);
propiedad.SetValue(comprobante.Persona.Carrera, strValor, null);
alguna idea?
De antemano, muchas gracias.