mardi 10 septembre 2019

C# 'type' is a variable but is used like a type

This code throws an error C# 'type' is a variable but is used like a type

Type type = Type.GetType("Objects.Camera");
for (int i = 0; i < ((List<type>)currentObject).Count; i++)
{
 //...
}

currentObject is obtained with .GetValue(object) and has type object. I need to cast it to the proper type in order to use it as a list.

Thank you





Aucun commentaire:

Enregistrer un commentaire