Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

In our projects, when ever we add a new method in the class and then from the scheduler they are accessing the method information through the DLL using Reflection and execute this method.

My query is we can achieve the same by adding the project reference and namespace and create an object of that class and invoke the method.
Is there any benefit using the above approach?

Please suggest on this.
Posted
Comments
BillWoodruff 11-Nov-13 8:30am    
Have you asked the person(s) who designed your current projects why they are using Reflection ?
Maarten Kools 11-Nov-13 9:42am    
If your method is publicly accessible, then there's no need to use reflection (I'd even strongly advise against it!). However, if the new method is internal or private, and they wish to use it anyway, reflection is their only option.
agent_kruger 11-Nov-13 9:47am    
the only difference i understand by reading the above article is that

by using DLL you can hide your code and use the method by accessing DLL
and by changing namespace it can save a lot of time

The biggest advantage of using Reflection is to access members methods,properties etc. at run time.
 
Share this answer
 
With reflection, you can load class libraries which were not yet available at the time of development. Sounds strange to you? Well, of course you should know something at the time of development: an Interface. Later, you create a new library with a new class (which implements that Interface). Then you add that dll to the program, set somewhere a configuration telling the appropriate Factory from where to load the new class, and voilà, you can load it and instantiate it via refelction. When it comes to other methods and properties, you can access them via the definitions of the interface.
 
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