lundi 26 août 2019

cast reflected result from object to list

how can i cast reflected result from object to list???

                Type tSource = item.SourceType;     //enum
                Type tDest = item.DestinationType;  //enum

                MethodInfo method = typeof(EnumConverters).GetMethod("GetEnumValues");
                MethodInfo methodGenericSource = method.MakeGenericMethod(tSource);
                object enumsSource = methodGenericSource.Invoke(null, null);
                //i need to convert enumsSource to List<tDest> (where tDest is enum)

                List<tDest> list = ???

exist some reflection function like "getResultGeneric" or "getResultOfType" ?!!?!?





Aucun commentaire:

Enregistrer un commentaire