how could i call a static method from a dll (wrote in c#) from my main program (also wrote in C#)?
public static class Entry
{
[DllImport("User32.dll", CharSet = CharSet.Unicode)]
private static extern int MessageBox(IntPtr h, string m, string c, int type);
// method which needs to be called
public static void init()
{
MessageBox((IntPtr) 0, "Executed", "Working.", 0);
}
}
Thats the dll.
public static void Main(string[] args)
{
var dll = Assembly.LoadFile(@"C:\Users\User\Desktop\mydll.dll");
foreach (var type in dll.GetExportedTypes())
{
// how to call the 'init()V' method without creating an instance?
}
}
Thats the executable.
Both the exe and the dll are wrote in the same .net version (4.5).
If i would like to obfuscate my dll, how could i get the init method after it got renamed?
Thanks.