Usage of the & quot; @ & quot; symbol in C #

Source: Internet
Author: User

 

The C # string, like Char, can contain Unicode and hexadecimal number escape sequences. Because these escape sequences start with a backslash (\), you cannot use this non-escape backslash character in the string, instead, two backslash characters ("\") are required to represent them:

String filepath = "c :\\ CSharp \ One. cs ";

Even if we believe that we can remember to do this under any circumstances, writing two backslashes is confusing. Fortunately, C # provides another alternative, you can add the character "@" before the string variable. All characters after "@" are considered as their original meaning-they are not parsed as escape characters:

String <A href = "mailto: filepath = @" c: \ CSharp \ One. cs "> filepath = @" c: \ CSharp \ One. cs ";

Even strings can contain line breaks:

String text = "I just want to share some movies

Which I think is valueable and be worth to have a try, to share the deep affection .";

The text value is: I just want to share some movies

Which I think is valueable and be worth to have a try, to share the deep affection;

No: I just want to share some movies which I think is valueable and be worth to have a try, to share the deep affection;

From: happy pig Column

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.