In my precent questions, I want to retrieve some values via reflection. Now I want set values to objects thanks to reflection.
I want to write this :
private void AppliquerColonnesPersonnalisation(Control control, Propriete propriete, PropertyInfo Info)
{
UltraGrid grille = (UltraGrid)control;
SortedList<int,string> sortedOrderedColumns = new SortedList<int,string>();
if (grille != null)
{
// I want to write MapPropertyInfo method
ColumnsCollection cols = MapPropertyInfo(Info);
PropertyInfo contains a type of ColumnsCollection. I just want to "map" my PropertyInfo to an object to define some properties after : For example :
cols[prop.Nom].Hidden = false;
Is it possible ?
Best Regards,
Florian
EDIT : I tried the GenericTypeTea solution, but I have some problem. Here my code snippet :
private void AppliquerColonnesPersonnalisation(Control control, Propriete propriete, PropertyInfo Info)
{
UltraGrid grille = (UltraGrid)control;
ColumnsCollection c = grille.DisplayLayout.Bands[0].Columns;
// Throw a not match System.Reflection.TargetException
ColumnsCollection test = Info.GetValue(c,null) as ColumnsCollection;
SortedList<int,string> sortedOrderedColumns = new SortedList<int,string>();
But a TargetException is Thrown