Solved

How to determine the type of a derived class?

Posted on 2007-11-30
2
281 Views
Last Modified: 2011-09-20
Hi:

To encapsulate data, I've subclassed several of the winform controls:

TextBox --> EWTextBox;
ComboBox --> EWComboBox;
ListBox --> EWListBox;

For generic handling, I store my derived controls in a list based on their common base class:
EWList<Forms.Control> ewTransactionUtilityControls = new EWList<.Forms.Control>();

Later, when I'm processing the list later, I would like to determine the derived class so I can do special processing according to the derived class type:

foreach( Control control in EWList)
{
     // Figure out whether "control" is an EWTextBox, EWComboBox, EWListBox
}

How do I do that?

0
Comment
Question by:jxbma
2 Comments
 
LVL 11

Accepted Solution

by:
Babycorn-Starfish earned 500 total points
ID: 20383287
try

if( control is ClassName)
0
 
LVL 1

Author Closing Comment

by:jxbma
ID: 31411953
Thanks man... I should have known this.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now