mardi 23 décembre 2014

accessing array members using reflection

It is possible access array elements using Reflection?


For example if i have the array



array<String^>^ Strings_Array=gcnew array<String^>{"One","Two","Three"};


And the function



Replace_Two(Object^ Strings_Array)
{
Type^ Array_Type=Strings_Array->GetType();

String^ Array_Type_Name=Array_Type->ToString(); //it is "System.ValueType[]"

//make magic to replace "Two" to "Four"

}


It is possible to do without type casting?



array<String^>^ Finction_Strings_Array=(array<String^>^)Strings_Array;


Thank you






Aucun commentaire:

Enregistrer un commentaire