void中的问题转换为bool [英] Problem in void convert to bool

查看:600
本文介绍了void中的问题转换为bool的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,当我执行时我得到的错误就像



不能隐式地将类型'void'转换为'bool



这是我的代码: -

bool blnResult = objMail.SendMail(ConfigurationManager.AppSettings [supportEmail]。ToString(),strFromMail,来自Live Help的查询,strMailString);





帮我.. !!

hello when i execute i get the error like

Cannot implicitly convert type 'void' to 'bool

here is my code :-
bool blnResult = objMail.SendMail(ConfigurationManager.AppSettings["supportEmail"].ToString(), strFromMail, "Query from Live Help", strMailString);


Help Me..!!

推荐答案

你好

问题发生在以下问题: -

你的
hello
your problem occur following problem:-
your
SendMail(ConfigurationManager.AppSettings["supportEmail"].ToString(), strFromMail, "Query from Live Help", strMailString);

函数返回类型是无效的,这就是为什么它无法转换为bool。首先检查它的返回类型,如果它的类型为void,则将其更改为bool和

返回true / false。





我希望你的问题能解决,如果没有请给我你的意见。

function return type is void that's why it can not be converted into bool .first check its return type and if its type is void than change it into bool and
return either true/false.


i hope your problem will solve if not please give me your comments.


你好,



Hi,

Quote:

bool blnResult = objMail.SendMail(ConfigurationManager.AppSettings [supportEmail]。ToString(),

bool blnResult = objMail.SendMail(ConfigurationManager.AppSettings["supportEmail"].ToString(),





用此替换上述声明..





replace above statement with this..

bool blnResult = Convert.ToBoolean(objMail.SendMail(ConfigurationManager.AppSettings["supportEmail"].value.ToString(), strFromMail, "Query from Live Help", strMailString));





即使你得到同样的错误,也可能是由于电子邮件CLient对象。



希望它有所帮助。



even if you are getting the same error, then may be due to Email CLient object.

hope it helps.


这篇关于void中的问题转换为bool的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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