Click here to Skip to main content
16,008,299 members
Home / Discussions / C#
   

C#

 
GeneralRe: problem in Class [modified] Pin
Luc Pattyn4-Jun-10 9:49
sitebuilderLuc Pattyn4-Jun-10 9:49 
GeneralRe: problem in Class Pin
OriginalGriff4-Jun-10 11:53
mveOriginalGriff4-Jun-10 11:53 
GeneralRe: problem in Class Pin
Luc Pattyn4-Jun-10 11:57
sitebuilderLuc Pattyn4-Jun-10 11:57 
AnswerRe: problem in Class Pin
Not Active4-Jun-10 6:57
mentorNot Active4-Jun-10 6:57 
QuestionEnterprise Library Logging Application Block: using special sources Pin
Shtel4-Jun-10 3:16
Shtel4-Jun-10 3:16 
QuestionFinding base class of an object Pin
dashingsidds4-Jun-10 3:07
dashingsidds4-Jun-10 3:07 
AnswerRe: Finding base class of an object Pin
JoeSharp4-Jun-10 3:27
JoeSharp4-Jun-10 3:27 
AnswerRe: Finding base class of an object Pin
Anthony Mushrow4-Jun-10 3:45
professionalAnthony Mushrow4-Jun-10 3:45 
You have a few options, you can as previously stated use the is keyword and see if it's the type you are looking for.
An alternative is to actually look at the BaseType:

Type t = ActiveMdiChild.GetType();
//You can then look at t.BaseType, I'd like to point out that if you inherit from
//an interface you will have to look at FindInterfaces

Type baseClass = t.BaseType;

//You can then create an instance of this type
object something = Activator.CreateInstance(baseClass);


However, unless there is a common base class that you can cast to so that you can use it then you are back to checking the actual type and casting to that.
So depending on what you have and what you need you can either have a series of if statements checking for the types or the above method where you will be able to create and use your base class without necessarily knowing exactly what it is.
My current favourite quote is: Punch them in the face, see what happens!
-SK Genius


GeneralRe: Finding base class of an object Pin
dashingsidds4-Jun-10 4:25
dashingsidds4-Jun-10 4:25 
AnswerRe: Finding base class of an object Pin
#realJSOP4-Jun-10 4:52
professional#realJSOP4-Jun-10 4:52 
QuestionIssue with Environment.SpecialFolder.MyDocuments Pin
False Chicken4-Jun-10 2:09
False Chicken4-Jun-10 2:09 
AnswerRe: Issue with Environment.SpecialFolder.MyDocuments Pin
Johnny J.4-Jun-10 2:16
professionalJohnny J.4-Jun-10 2:16 
GeneralRe: Issue with Environment.SpecialFolder.MyDocuments Pin
False Chicken4-Jun-10 2:22
False Chicken4-Jun-10 2:22 
GeneralRe: Issue with Environment.SpecialFolder.MyDocuments Pin
Johnny J.4-Jun-10 2:23
professionalJohnny J.4-Jun-10 2:23 
Questioncolor get changed in another pc Pin
eraser9504-Jun-10 2:03
eraser9504-Jun-10 2:03 
AnswerRe: color get changed in another pc Pin
OriginalGriff4-Jun-10 2:26
mveOriginalGriff4-Jun-10 2:26 
AnswerRe: color get changed in another pc Pin
Hristo-Bojilov4-Jun-10 2:27
Hristo-Bojilov4-Jun-10 2:27 
QuestionConvert System.Drawing.Image to System.Web.UI.WebControls.Image Pin
Add44-Jun-10 0:55
Add44-Jun-10 0:55 
AnswerRe: Convert System.Drawing.Image to System.Web.UI.WebControls.Image Pin
Hristo-Bojilov4-Jun-10 1:55
Hristo-Bojilov4-Jun-10 1:55 
QuestionHow to control a outer application? [modified] Pin
imbiz3-Jun-10 23:46
imbiz3-Jun-10 23:46 
AnswerRe: How to control a outer application? Pin
Luc Pattyn4-Jun-10 0:38
sitebuilderLuc Pattyn4-Jun-10 0:38 
GeneralRe: How to control a outer application? Pin
imbiz4-Jun-10 2:20
imbiz4-Jun-10 2:20 
GeneralRe: How to control a outer application? Pin
Luc Pattyn4-Jun-10 7:18
sitebuilderLuc Pattyn4-Jun-10 7:18 
GeneralRe: How to control a outer application? [modified] Pin
imbiz4-Jun-10 21:39
imbiz4-Jun-10 21:39 
Questionlistbox Pin
kennyhibs3-Jun-10 22:30
kennyhibs3-Jun-10 22:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.