c# - Calls to Twilio Method is ambiguous -
I am trying to send an SMS using twilio, but when I use the code, Errors are available:
Error 1
Error 11 call is ambiguous between the following methods or properties: 'Twilio.TwilioRestClient.SendMessage (string , String, string, string [], string) 'and' tivialo Twillest client.msms (string, string, string, string [], system. Action) 'C: \ development \ testSMS statement. Espacks C Error 2
can not specify a vested-type local variable to zero
Does anyone know how I can fix this?
The code is
// twilio.com/user/account Find your account, Sid and Oth Tokens on String Accountcid = "MySide"; String AuthToken = "Mayutocon"; Var libilio = new twiliorrstclient (accountcid, orthocon); Var message = twilio.SendMessage ("+ 441618504425", "07914164512", "Code is 123456", blank, empty); Console.WriteLine (message.Sid);
The problem is that overloaded in
SendMessage Is there a
string type in the last parameter and one that
verb & lt; Twilio.Message & gt; takes as it takes. You are going through this code for
null , which is acceptable for both of these types, however, it confuses the compiler because it does not work much that you want to call it.
For example, if you pass an empty string such as the last parameter
twilio.SendMessage ("+ 441618504425", "07914164512", "Code is 123456" , Blank, "");
Then the compiler will know that you want the overload at the end of the
string parameter, not with a
action. & Lt; Twilio.Message & gt; . Alternatively, if you have a blank
action & lt; Twilio.Message & gt; Parameter e.g.
twilio.SendMessage ("+ 441618504425", "07914164512", "Code 123456" passed), tap, (msg) = & gt; {});
Then you will know that you want to call a
action & lt; Twilio.message & gt; takes the parameter and
string not. <
Finally, I believe that this error
/ code> actually Do not return anything to fix, just change
var message = twilio.SendMessage (...);
to
twilio.SendMessage (...);
Comments
Post a Comment