kenng Posted September 3, 2003 Posted September 3, 2003 If I have a string abc, String abc = "int"; how can I declare some variables using abc's value as data type?:confused: Really thx =0= Quote
*Experts* Volte Posted September 3, 2003 *Experts* Posted September 3, 2003 Not very easily, I don't think. You might be able to do it with Reflection, but it shouldn't be necessary. You can just use the Object datatype to hold whatever value you need. Quote
kenng Posted September 3, 2003 Author Posted September 3, 2003 Thx for your advice! but actually, I really want to use such method to solve my problem. coz I write some code to get other classes function name by looping vector. I get those name and datatype in string format. I need to call them in my class =__________= (p.s hope that you know my meaning, poor english /___\) Quote
*Gurus* divil Posted September 3, 2003 *Gurus* Posted September 3, 2003 Whatever you're trying to do, you can be sure there's a better way of doing it than specifying a type name (which is compiler specific) in a string at runtime. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.