Narayanan Dayalan

Hi Friends,

IĄ¯m new to reflection, what I want isĄ­

List<FOUnitClassMst> objFOUnitClassMst = new List<FOUnitClassMst>();
FOUnitClassMstBl objFOUnitClassMstBl = new FOUnitClassMstBl();

objFOUnitClassMst = objFOUnitClassMstBl.SelectAll();
sXMLReturnString = objGenSerial.XMLSerialize(objFOUnitClassMst);

the above is the code what I have in my current project, I want to implement reflection. I just want to know if this can be done. If this can be done then can any one help me in coding

I will pass the class FOUnitClassMst as string, and even FOUnitClassMstBl as string. If needed I will also pass SelectAll() method to it.

I want to convert the above string to list of object, and then convert FOUnitClassMstBl to object which is a business layer, I want to execute a method called SelectAll() which resides inside the business layer FOUnitClassMstBl. How can I achieve this

Please reply back if any one know the solution for this, I badly need this to be done.






Re: Visual C# Language Reflection For Class

Greg Beech

Look at:

Type.GetType / Assembly.GetType
Activator.CreateInstance
Type.GetMethod / MethodInfo.Invoke

Whether this is a good idea or not is dubious though; reflection is slow and resource intensive, and if you do this you'll lose the ability to refactor your code because class names will be hard coded. If you're trying to achieve an IoC pattern you might be better off checking out something like the Spring .NET framework.





Re: Visual C# Language Reflection For Class

Narayanan Dayalan

Hi Beech,

Thanks for ur reply. it helped me lot in fixing my problem. i'm currently working on my project using ur guidance...