loki
loki

Reputation: 2966

how to use public method via reflection method from another dll?

i want to use run execute method in dll. i have 2 dll i can access my startup dll'RUN method:

This below codes can not run Execute method another DLL(NetworkProcessor) . i want to ınvoke NetworkProcessor.IpPing class'execute method. but i can not. how to to it using reflection?

public void RUN(string uri, string serverGuid)
{
    //something...
    //something...
    //something...

Upvotes: 0

Views: 179

Answers (1)

C.Evenhuis
C.Evenhuis

Reputation: 26436

If you specify BindingFlags.Public you also need to specify either BindingFlags.Instance or BindingFlags.Static, or both:

MethodInfo minfo = instance.GetType().GetMethod("Execute", BindingFlags.Public | BindingFlags.Instance);

Currently neither is specified, causing GetMethod to return null.

Upvotes: 3

Related Questions