Skip to content

Function pointer

anooshiravan keshavarzi

Asked Aug 28, 2009, 1:18 AM EDT1 answer
Share
LinkedInX
I am using a loop like the one below:
foreach(ProcessThread p in Process.GetCurrentProcess().Threads)
Code
intPtr address = p.StartAddress;

and I want to compare this address to a method's address
which I have used to start a thread.
the question is how to get the address of a method in the format of int or intPtr?

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Hi,
    You can use delegates for reference pointing to methods.
    Here is an explanation.
    http://msdn.microsoft.com/en-us/library/ms173171(VS.80).aspx
    Delegates (C# Programming Guide)


    A delegate is a type that references a method. Once a delegate is assigned a method, it behaves exactly like that method. The delegate method can be used like any other method, with parameters and a return value, as in this example:

    Thank you,
    Vivek
     
    0