dimanche 9 décembre 2018

Instances using Reflection

I have class with 2 properties. The one is a List<double> and the other one is a Queue<double>. I only have the Type information during runtime. I need to instantiate and populate both the properties. Is there a generic way of doing this? I have created a method that will create an IEnumerable because that is a common interface for both of these. However, now I'm stuck with an IEnumerable and I don't know how to cast to something useful to Add or Enqueue based on Type.





Aucun commentaire:

Enregistrer un commentaire