I have a generic method, so:
There are two possibilities for <T>: <Category> and <ProductSupplier>. Previous to this call, I have a method which uses reflection to get a List<T> object (at least, I think it is; Invoke returns an object object and setting myList to dynamic allows me to access the data properties), populated with either Category or ProductSupplier data:
where cRet is an object with GetCategories() and GetProductSuppliers() methods, and parms.data is a string with either "GetCategories" or "GetProductSuppliers" as a value.
So, what I would like to be able to do is inject either of the two possibilities for <T> into the Export method at runtime. The parm object is a set of parameters that are passed into a worker method pursuant to a ParameterizedThreadStart call.
Is this doable?
An unforeseen consequence of the information revolution has been the exponential propagation of human error.
Code:
public void Export<T>(List<T> exportList, string filePath, byte fileType) where T: class
There are two possibilities for <T>: <Category> and <ProductSupplier>. Previous to this call, I have a method which uses reflection to get a List<T> object (at least, I think it is; Invoke returns an object object and setting myList to dynamic allows me to access the data properties), populated with either Category or ProductSupplier data:
Code:
dynamic myList = cRet.GetType().GetMethod(parms.data).Invoke(cRet, null)
where cRet is an object with GetCategories() and GetProductSuppliers() methods, and parms.data is a string with either "GetCategories" or "GetProductSuppliers" as a value.
So, what I would like to be able to do is inject either of the two possibilities for <T> into the Export method at runtime. The parm object is a set of parameters that are passed into a worker method pursuant to a ParameterizedThreadStart call.
Is this doable?
An unforeseen consequence of the information revolution has been the exponential propagation of human error.