In. Net (C #), how can we better implement string line breaks?

Source: Internet
Author: User

(Read CLR via C # Feelings)
If we want to display a line break, we usually write "\ r \ n" in this way. After reading CLR via C #, we can find the original one. net also provides a better method: system. environment. newline. That is, add a new line!
Why? Do you want to do this one more? Of course not! It is to achieve cross-platform problems! For example, in windows, "\ r \ n" will be interpreted as a line feed, but it will not be used in other platforms such as Linux! When system. environment. newline is used, CLR automatically generates a carriage return (line feed) when converting to a machine code based on the operating system and other environments.Code! (Although. Net does not have any cross-platform applications, it will certainly be available in the near future !)

Original http://www.free56.cn/post/32.html

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.