Given the following class:
public class SampleViewModel
{
public TheModel Model { get; set; }
public SampleViewModel()
{
this.Model = new TheModel();
}
public class TheModel
{
public string Name { get; set; }
public int Age { get; set; }
public DateTime Birthdate { get; set; }
}
}
Which is instantiated as:
var svm = new SampleViewModel();
How do I, with reflection, list the properties within svm.Model?
Note: If I use the normal GetProperties method on svm.Model I get 14 properties, all kinds of propertyinfo fields popup and none of the properties from TheModel class.
Note 2: Ok, tried with an external code like this:
var svm = new SampleViewModel();
var props = typeof(SampleViewModel).GetProperties();
var innerprops = svm.Model.GetType().GetProperties();
This seems to work, now I need to figure out why the same doesnt't work when I do it inside my framework with instances created with Activator.CreateInstance. :)
thanks, pom