Cast with reflection

Hello

How I can cast something using reflection?

Example:



String typ = "TextBox";

(Reflection(typ))MyClass = (Reflection(typ))PointerClass.GetData();

MyClass should be a TextBox class with the Instance in the PointerClass.GetData() saved Data.

Thanks
Tony

[495 byte] By [Tony] at [2007-12-16]
# 1
Tony,

Your question is not very clear. The way you are using Reflection is like a keyword - and I there is no Reflection keyword in C#.

if PointerClass.GetData is returning a type TextBox/Object then you don't need reflection you can directly cast it

TextBox MyClass = (TextBox)PointerClass.GetData();

If that's not the case, please elobrate what you are trying to acheive.

Regards,
Saurabh Nandu
www.MasterCSharp.com
www.AksTech.com

SaurabhNandu at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...