use this as the class change the name to fit
namespace myNamespace
{
internal class MyClass
{
MyClass()
{
}
private static string DoGreeting()
{
return "helloworld";
}
private static string DoGreeting2(string value)
{
if(value == null)
{
value = "";
}
return value;
}
}}
now to use this in code you would use
const BindingFlags MyBinding = (BindingFlags)(-20);
Assembly asm = Assembly.LoadFrom(Application.StartupPath + "\\myClass.dll");
object obj = asm.CreateInstance("myNamespace.myClass", true, MyBinding, null, null, null,null);
string result = (string)obj.GetType().GetMethod("DoGreeting", MyBinding).Invoke(null, null);
MessageBox.Show(result);
and to use method 2 just do the same as the first while passing the string value to display as such
const BindingFlags MyBinding = (BindingFlags)(-20);
Assembly asm = Assembly.LoadFrom(Application.StartupPath + "\\myClass.dll");
object obj = asm.CreateInstance("myNamespace.myClass", true, MyBinding, null, null, null,null);
string result = (string)obj.GetType().GetMethod("DoGreeting2", MyBinding).Invoke(null, new object[]{"Hello America"});
MessageBox.Show(result);