TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
neubs007
NA
4
0
Casting & Reflection
Jan 27 2005 3:24 PM
I have to perform a cast of an object based on the type of another object. I can get it to work for one instance by coding in the objects. eg. Person p = (Person)dgi.DataItem; If I look at dgi.DataItem.getType() I can see that, in this case, it is a person object. Now what do I need to do to abstract that out so dgi.DataItem can be a different objects within my solution? I figure I can use reflection from dgi.DataItem to fill in the ???'s below, but I'm not sure how. ??? p = (???)dgi.DataItem So if dgi.DataItem.getType()... is a Dog object it would render the statement as such: Dog p =(Dog)dgi.DataItem Any Ideas?
Reply
Answers (
3
)
Simple UDP socket...??
combo box not showing items