further to my previous question, I have a new problem now, I want to get a property which is an array :
string propertyName="DisplayLayout.Bands[0].Columns";
PropertyInfo pi = control.GetType().GetProperty(propertyName)
But actually, it returns null.
Best Regards,
Florian
Edit : Sorry for the lack of precision :$ I access to Bands property thanks to the answers of my precent question. My real problem is to access at the ‘Columns’ property which is a property of type ‘Band’. I hope it’s more clear.
EDIT2 : here an example :
PropertyInfo t = control.GetType().GetProperty(entry.Value[i].Nom.Split(new char[] { '.' })[0]);
PropertyInfo property = control.GetType().GetProperty(entry.Value[i].Nom.Split(new char[] { '.' })[0]);
PropertyInfo nestedProperty = property.PropertyType.GetProperty("Bands");
in nestedProperty I have Bands (Infragistics.UltraWinGrid.BandsCollection Bands) but I don’t manage to access Bands[0] and the ‘Column’ Property
The syntax
Bands[0]is an indexer access. Indexers are a properties that take parameters. C# doesn’t allow properties with parameters to be accessed by name, but allows indexer syntax for the property matching the name given in a DefaultMemberAttribute on type type. To get thePropertyInfofor the indexer in your example, you could write:In order to get a value from the indexer, you will need to supply a second parameter to PropertyInfo.GetValue with the values to pass in: