Question: I would like to access a function of a program from which is attached a DLL.

In DLL I've tried:

```
Assembly assembly = Assembly.GetExecutingAssembly();
Type type = assembly.GetType("Uranium");
MethodInfo methodInfo = type.GetMethod("Util");

methodInfo.Invoke("SendClient", new object[] { Packet.GetData()});

```

But not works I get a null exception but not say the line.
The running program is called and namespace is 'Uranium', the class is 'Util' and function is 'SendClient'.

Answer: 
I have been able solve it on my own.

Code:

```
Assembly assembly = Assembly.LoadFrom("Uranium.exe");
Type type = assembly.GetType("Uranium.Util");
MethodInfo methodInfo = type.GetMethod("SendClient");

methodInfo.Invoke(null, new object[] { Packet.GetData() });

```
You first need to find the assembly that contains the type. Also, you need to pass the class name to `GetType()`, not the namespace, and method name to `GetMethod()`, not class name.

```
foreach (Assembly currentassembly in AppDomain.CurrentDomain.GetAssemblies()) 
{
    Type t = currentassembly.GetType("Util", false, true);
    if (t != null) 
    {
        MethodInfo methodInfo = type.GetMethod("SendClient");
        methodInfo.Invoke(Activator.CreateInstance(t),new object[] { Packet.GetData()});
    }
}

```