public static void SendEmail(String from, String To, String Subject, String HTML, String AttachmentPath = null, String AttachmentName = null, MediaTypeNames AttachmentTy
A workaround to passing static parameters is to pass it as an object.
Function:
public static void HoldKey(object key)
{
...
}
Call function:
Function(static param);
You can wrap static types around an interface or another non-static class and add that as the parameter. Not ideal but a way around it. Or simply just reference the static type in the method body itself.
You can't pass a static type to a method as a parameter because then it would have to be instantiated, and you can't create an instance of a static
class.
Use a different type for the argument.
A method argument needs to be of a type that can accept a reference to an instance, so it can't be a static class.
Send a static class as the type of the parameter and then give it a variable name for use in the function. This works because the new variable is a reference to the static class. It is necessary to address the global variable problem. If you use a static class as a variable inside a method, you need to pass it in as a parameter, to avoid the global variable issue. This is basic structured programming 101 from the 80's.
The best deal is definitely to remove the last parameter. Since type is static you don't need a reference to an instance and you can refer to its members from your function body.