Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am new to reflection in .net. I have a method in a dll (Public Dictionary<int,collectedhistory> CollectData()), where CollectedHistory is a class in the same dll. This class has 3 lists as properties (List of strings).

I am invoking this method from another assembly using reflection. And the result of this method has been assigned to a VAR object.

But, I am not clear, how can I type cast the output of this method in to Dictionary<int,collectedhistory)>CollectData() method exists).

Please advise me, how to type cast the method output to the proper type.
Posted
Updated 8-Jul-15 7:33am
v2
Comments
Sergey Alexandrovich Kryukov 8-Jul-15 15:15pm    
Who told you that you need to type-case anything? Why? The purpose? Why reflection?
—SA

1 solution

You will need a shared reference such as an interface or abstract class. both of your assemblies should reference the shared object.

The other option it to create three properties that return each of the List<string>. You can use these types in both of your assemblies because you have a shared resource in System.Collections
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900