String. Empty

Source: Internet
Author: User
String. Empty field The. NET Framework class library represents a null string. This field is read-only. Namespace: System Program Set: mscorlib (in mscorlib. dll) protected string loginid = string. Empty ; Protected string loginid = ""; string. empty does not allocate a bucket "" to allocate a bucket with an empty length. empty uses string for cross-platform scenarios. empty in C #, in most cases, "" and string. empty Can be used interchangeably. For example: String S = ""; string S2 = string. empty; If (S = string. empty) {//} if statements are written in the order of S. length = 0 is better than S = string. empty is better than S = "" about string. the problem with empty and null is that both of them indicate null strings, and one of them focuses on string str1 = string. the difference between empty and string str2 = NULL. After this definition, str1 is an empty string, and the empty string is a special string, except that the value of this string is null, in the memory, there is an accurate point. String str2 = NULL. After this definition, only a reference to the string class is defined, and str2 does not point to any place, if it is not instantiated before use, an error will be reported. Textbox1.text is a zero-length string "". Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for smartphone, Windows Server 2003, Windows XP Media Center edition, Windows XP Professional x64 edition, Windows XP SP2, Windows XP Starter Edition

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.