|
-
June 18th, 2012, 12:28 PM
#4
Re: Choose class type without switch
You're not going to be able to do it without using a lot of reflection, though it is possible. Here's an overview of one approach: http://www.codeproject.com/Articles/...with-C-and-NET
You can pick the parts that you need. You probably don't need to collect *all* of the assembly's classes into the dictionary, just your Fruit types, so it should be less cumbersome. I would almost prefer writing some code to auto-generate the switch statement though.
If you liked my post go ahead and give me an upvote so that my epee.... ahem, reputation will grow.
Yes; I have a blog too - http://the-angry-gorilla.com/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|