Click here to Skip to main content
15,899,314 members
Home / Discussions / C#
   

C#

 
GeneralRe: Getting Icon Name from notifyIcon1 Pin
Dave Kreskowiak16-Jun-04 4:21
mveDave Kreskowiak16-Jun-04 4:21 
GeneralRe: Getting Icon Name from notifyIcon1 Pin
Mike Dimmick16-Jun-04 4:25
Mike Dimmick16-Jun-04 4:25 
GeneralHttpWebRequest - Only Partial Page Returned Pin
bludvl9016-Jun-04 3:26
bludvl9016-Jun-04 3:26 
GeneralRe: HttpWebRequest - Only Partial Page Returned Pin
Heath Stewart16-Jun-04 4:28
protectorHeath Stewart16-Jun-04 4:28 
GeneralShell execute in C# Pin
Member 445055116-Jun-04 3:24
Member 445055116-Jun-04 3:24 
GeneralRe: Shell execute in C# Pin
Colin Angus Mackay16-Jun-04 3:36
Colin Angus Mackay16-Jun-04 3:36 
GeneralRe: Shell execute in C# Pin
Member 445055116-Jun-04 5:55
Member 445055116-Jun-04 5:55 
GeneralGet type of derived class from base class Pin
joev16-Jun-04 3:06
joev16-Jun-04 3:06 
My first CP question! Gosh! Smile | :)

This problem is driving me crazy because there is an itch in my brain saying that there has to be *some* way of doing it.

I have base class A, I derive Class B from class A.

Now in class A I have a method that I wish to output the type of the class that the current instance is.

Note: I can't use typeof(this) since I want to be able to use this with versions of A and/or B that include static members.

e.g.

public class A
{
    A() 
    {
    }
    public static PrintType()
    {
       System.Type myType = System.Reflection.MethodBase.GetCurrentMethod().ReflectedType;
       Debug.Print(myType.ToString());
    }
} 

public B : A
{
}


B.PrintType() should, in theory print B as the type... but it always prints A...

This is driving me crazy.. I'm sure there has to be some way for the base class to find out if a method is being called from a derived class in a way that's compatible with using statics (going the other way is a breeze) but I just can't seem to put my finger on it.

Any help greatly appreciated.

Thanks

joev
GeneralRe: Get type of derived class from base class Pin
Heath Stewart16-Jun-04 4:21
protectorHeath Stewart16-Jun-04 4:21 
GeneralRe: Get type of derived class from base class Pin
joev16-Jun-04 10:39
joev16-Jun-04 10:39 
GeneralRe: Get type of derived class from base class Pin
joev16-Jun-04 10:53
joev16-Jun-04 10:53 
GeneralRe: Get type of derived class from base class Pin
Heath Stewart16-Jun-04 10:58
protectorHeath Stewart16-Jun-04 10:58 
GeneralRe: Get type of derived class from base class Pin
joev16-Jun-04 11:09
joev16-Jun-04 11:09 
Generalline color of textBox or listBox Pin
Member 117814516-Jun-04 2:03
Member 117814516-Jun-04 2:03 
GeneralRe: line color of textBox or listBox Pin
LongRange.Shooter16-Jun-04 4:13
LongRange.Shooter16-Jun-04 4:13 
GeneralRe: line color of textBox or listBox Pin
Member 117814516-Jun-04 4:26
Member 117814516-Jun-04 4:26 
GeneralInterfaces in C# Pin
saud_a_k16-Jun-04 1:46
saud_a_k16-Jun-04 1:46 
GeneralRe: Interfaces in C# Pin
IamADotNetGuy16-Jun-04 3:39
IamADotNetGuy16-Jun-04 3:39 
GeneralRe: Interfaces in C# Pin
LongRange.Shooter16-Jun-04 4:27
LongRange.Shooter16-Jun-04 4:27 
GeneralRe: Interfaces in C# Pin
saud_a_k16-Jun-04 18:40
saud_a_k16-Jun-04 18:40 
GeneralRe: Interfaces in C# Pin
Stefan Troschuetz16-Jun-04 19:31
Stefan Troschuetz16-Jun-04 19:31 
GeneralRe: Interfaces in C# Pin
saud_a_k16-Jun-04 19:41
saud_a_k16-Jun-04 19:41 
GeneralRe: Interfaces in C# Pin
Stefan Troschuetz16-Jun-04 19:46
Stefan Troschuetz16-Jun-04 19:46 
GeneralRe: Interfaces in C# Pin
LongRange.Shooter17-Jun-04 3:22
LongRange.Shooter17-Jun-04 3:22 
GeneralDate Picker in DataGrid Pin
sulmun16-Jun-04 0:19
sulmun16-Jun-04 0:19 

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.