public static void SendEmail(String from, String To, String Subject, String HTML, String AttachmentPath = null, String AttachmentName = null, MediaTypeNames AttachmentTy
It's not recommended but you can simulate use of Static classes as parameters. Create an Instance class like this :
public class Instance
{
public Type StaticObject { get; private set; }
public Instance(Type staticType)
{
StaticObject = staticType;
}
public object Call(string name, params object[] parameters)
{
MethodInfo method = StaticObject.GetMethod(name);
return method.Invoke(StaticObject, parameters);
}
public object Call(string name)
{
return Call(name, null);
}
}
Then your function where you would use the static class :
private static void YourFunction(Instance instance)
{
instance.Call("TheNameOfMethodToCall", null);
}
For instance.Call :
And use like this :
static void Main(string[] args)
{
YourFunction(new Instance(typeof(YourStaticClass)));
Console.ReadKey();
}
It doesn't look like you even use that parameter in your method. You should just remove it because MediaTypeNames
cannot be instantiated anyway.