运算符"+"不能应用于类型为“字符串"和“方法组"的操作数 [英] Operator '+' cannot be applied to operands of type 'string' and 'method group'

查看:508
本文介绍了运算符"+"不能应用于类型为“字符串"和“方法组"的操作数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我收到了给定的错误,如果有人知道,请让我知道.


运算符"+"不能应用于类型为字符串"和方法组"的操作数



hi all,

i got the given error, please let me know if anybody knows this..


Operator ''+'' cannot be applied to operands of type ''string'' and ''method group''



Source Error:

Line 190:
Line 191:                strsubject = Session["user_name"] + " - Updated Account";
Line 192:                strbody = " Hi " + Session["user_name"] + ",<br>" + "      You have successfully Allocated new Destination details. Please find the details below:<br><br> " + "       Access Number      - '" + accessnumber + "' <br>" + "       Destination Number  - '" + TextBoxDest.Text.Trim + "'     <br>" + "       Reference Name     - '" + TextBoxRef.Text.Trim + "'     <br><br>";
Line 193:                strbody = strbody + " Thank you for choosing this.<br><br>.";
Line 194:                if (Session["user_email"] != null)







我的代码是:







my code is:

string strsubject = null;
                string strtoaddress = null;
                string strbody = null;
                string strcc = null;
                string strbcc = null;

                strsubject = Session["user_name"] + " - Updated Account ";
                strbody = " Hi " + Session["user_name"] + ",<br>" + "      You have successfully Allocated new Destination details. Please find the details below:<br><br> " + "       Access Number      - '" + accessnumber + "' <br>" + "       Destination Number  - '" + TextBoxDest.Text.Trim + "'     <br>" + "       Reference Name     - '" + TextBoxRef.Text.Trim + "'     <br><br>";
                strbody = strbody + " Thank you for choosing this .<br><br>.";
                if (Session["user_email"] != null)
                {
                    strtoaddress = Session["user_email"] + ConfigurationManager.AppSettings["SendMail_from"];
                }

推荐答案

由于您正在使用C#,因此它必须是

Since you are using C# it needs to be

TextBoxDest.Text.Trim()



请注意括号.



Note the parentheses.


TextBoxDest.Text.Trim应为TextBoxDest.Text.Trim()
TextBoxRef.Text.Trim应该是TextBoxRef.Text.Trim()
TextBoxDest.Text.Trim should be TextBoxDest.Text.Trim() and
TextBoxRef.Text.Trim should be TextBoxRef.Text.Trim()


好吧,我现在无法访问ASP.NET服务器,所以这只是一个猜测,但是更改
Well, I can''t now access to an ASP.NET server, so it''s only a guess, but what about changing
TextBoxRef.Text.Trim

TextBoxRef.Text.Trim()

吗?很简单,我想您错过了方括号.

? Simple, I think you missed the brackets.


这篇关于运算符"+"不能应用于类型为“字符串"和“方法组"的操作数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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