[C #] The operator "+" cannot be applied to operands of the "string" and "method group" types.

Source: Internet
Author: User

C # One of the annoying programming habits is that after the get method of an object is automatically prompted, you are not given brackets. This is still the case when the object is promoted to any this point, if you are not careful, it's really crazy.

I just made another small mistake. It's too light to trust C #.CodeThe prompt function. This method will not add parentheses to you after the prompt, for example, the following section:

// Concatenate SQL statement row 184: String STR = "Update trialdoc set" + row 185: "doclastedittimer = '" + Doc. getdoclastedittimer () + "'where id =" + Doc. GETID + "";

Suddenly, the brackets of GETID were lost. The result is a tragic reminder:

Compiler error message: cs0019: The operator "+" cannot be applied to operands of the "string" and "method group" types

Therefore, sometimes we should not be lazy. If we are lazy and have to bear the consequences, we have to be flexible in mind. We have brackets in front and we lose our heads.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.