mercredi 12 juillet 2017

How to set rows of reflected array of a custom class

how can i set the first and second row of my Array By reflection , i have set my values to my custom objects, but i cant assign it to the array , because the first and second rows are null

var reflectedArray= Array.CreateInstance(classNameType, 2);

Object itemOfArrayTemp =Activator.CreateInstance(classNameType);

reflectedArray[0] = myValue1;

reflectedArray[1] = myValue2;

the error is : Cannot apply indexing with [] to an expression of type 'Array'





Aucun commentaire:

Enregistrer un commentaire