vendredi 16 mars 2018

Cast to dynamic list with reflection c# [duplicate]

This question already has an answer here:

How to cast a List of X object, based on the name in string?

I have this case:

public void AssignValue(string className, Dataset.Table table){
    Type currentType = Type.GetType("Namespace." + className);
    var objectCasted = (List<currentType.GetType()>)result;
} 

Then, I'm trying to cast a List of a dynamic object, how I can do it using reflection?





Aucun commentaire:

Enregistrer un commentaire