'TwilioRestClient'不包含'SendSmsMessage'的定义,也没有找到接受第一个类型'TwilioRestClient'的扩展方法'SendSmsMessage'。请帮忙!! [英] 'TwilioRestClient' does not contain a definition for 'SendSmsMessage' and no extension method 'SendSmsMessage' accepting a first argument of type 'TwilioRestClient' could be found. Please Help!!

查看:82
本文介绍了'TwilioRestClient'不包含'SendSmsMessage'的定义,也没有找到接受第一个类型'TwilioRestClient'的扩展方法'SendSmsMessage'。请帮忙!!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


公共类SmsService:IIdentityMessageService
{
public Task SendAsync(IdentityMessage message)
{
string AccountSid =" myAccountSID" ;;
string AuthToken =" myAuthToken" ;;
string twilioPhoneNumber =" MyTwilioPhoneNumber" ;;

var twilio = new TwilioRestClient(AccountSid,AuthToken);

twilio.SendSmsMessage(twilioPhoneNumber,message.Destination,message.Body);

public class SmsService : IIdentityMessageService { public Task SendAsync(IdentityMessage message) { string AccountSid = "myAccountSID"; string AuthToken = "myAuthToken"; string twilioPhoneNumber = "MyTwilioPhoneNumber"; var twilio = new TwilioRestClient(AccountSid, AuthToken); twilio.SendSmsMessage(twilioPhoneNumber, message.Destination, message.Body);

// **** TwilioRestClient不包含SendSmsMessage的定义*****

//****TwilioRestClient does not contain a definition for SendSmsMessage*****

返回Task.FromResult(0);
}
}

return Task.FromResult(0); } }

推荐答案

这意味着SendSmsMessage函数不接受你想要传递它的论据。右键单击该功能并转到"定义"。或者,在函数调用中删除并添加左paren以获取Intellisense。无论哪种情况,你都可以
到达你可以使用的函数的重载。然后你需要确保你正在调用其中一个。鉴于您发布的代码,看起来您传递了3个字符串,因此需要重载。

That means the SendSmsMessage function doesn't accept the arguments you're trying to pass it. Right click the function and Go To Definition. Alternatively remove and add back the left paren on the function call to get Intellisense. In either case you can get to the overload(s) of the function that you can use. You then need to ensure that you're calling one of those. Given your posted code it looks like you're passing 3 strings so there would need to be an overload for that.

如果Go To Definition不起作用,那么函数名称不是有效。再次输入客户名称并加上一个点,您应该获得可用成员的智能感知。

If Go To Definition doesn't work then the function name isn't valid. Type the client name again and put a dot and you should get Intellisense for the available members.


这篇关于'TwilioRestClient'不包含'SendSmsMessage'的定义,也没有找到接受第一个类型'TwilioRestClient'的扩展方法'SendSmsMessage'。请帮忙!!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆