I have a main class where I am looping through each internal property in my cleats class property. Each internal property in my cleats class is of type BeltProperty
(another class that contains information like value and id's).
private ObservableCollection<Cleats> _Cleats = new ObservableCollection<Cleats>();
/// <summary>
/// Cleats
/// </summary>
public ObservableCollection<Cleats> Cleats { get { return _Cleats; } }
foreach (PropertyInfo prop in typeof(Cleats)
.GetProperties(BindingFlags.Instance | BindingFlags.NonPublic))
{
BeltProperty bp = new BeltProperty();
bp = (BeltProperty)Cleats[Configurator_2016.Cleats.SelectedConfigurationIndex]
.GetType().GetProperty(prop.Name, BindingFlags.Instance | BindingFlags.NonPublic)
.GetValue(this, null);
//rest of the code...
}
On the first BeltProperty
it finds it throws a System.Reflection.TargetException
. I want to know if there is another/better way to get the property from my cleats class. Thanks in advance for any help or advice.