I have a variable (type: object
) called o. I also have a variable (type: Type
) called t. I know that o is an EntitySet
with the type of t with a single entry in it.
I need to get the first element in the EntitySet so that I can use reflection on it to get it's propertys. Have tried a couple of approaches to getting the first element, but none have worked.
- Cast o to EntitySet - sounds good but dont know how to do this with t being a variable that can change
- Cast o to dynamic
- Cast o to EntitySet - The intention is that then I can use the methods of EntitySet and get first object but it throws an exception
Have:
Type t;
object o; // we know it's EntitySet<t>
I need
t firstElement = o[0];
Aucun commentaire:
Enregistrer un commentaire