Parameter specifiers not allowed by default

I have the following code that gives an error

Parameter specifiers not allowed by default

How can this be fixed?

bool listSubscribe(string apikey, string id, string email_address, string [] merge_vars, string email_type="html", bool double_optin=false, bool replace_interests=true, bool send_welcome=false); bool listUnsubscribe(string apikey, string id, string email_address, bool delete_menber=false, bool send_goodbye=true, bool send_notify=true); 
+7
source share
4 answers

According to your error message, you cannot do this in version 3.5.

Work around is a few constructors:

 bool listUnsubscribe(string apikey, string id, string email_address) { return listUnsubscribe(apikey, id, email_address, false, true, true); } bool listUnsubscribe(string apikey, string id, string email_address, bool delete_menber, bool send_goodbye, bool send_notify) { return whatever; } 
+16
source

I just ran into this error and my project also targets 4.0, not 3.5 or lower.

I switched it to 3.5, and then back to 4.0, and then the error went away. Hope these steps will work for you or someone else.

+9
source

The application / class library is not configured on the target .NET platform 4. Configure on the project settings page.

enter image description here

+7
source

Additional options are the C # 4 feature, not present in earlier versions. Since you are using .NET 3.5, you cannot use optional parameters.

Switch to .NET 4.0 or use overloaded methods.

+3
source

All Articles