2.4string type simple operation

Source: Internet
Author: User
Simple string
1 using system;
2 using system. Collections. Generic;
3 using system. text;
5 namespace _. _ simplesstring
6 {
7 class Program
8 {
9 static void main (string [] ARGs)
10 {
11 string a = "simple string ";
12 string B =;
13 console. writeline ("meaning string is the demo result of the Application Type:" + (object) A = (object) B ));
14 // the string is a reference type. When the "=" operator is used to assign a value, the two variables point to the same location in the managed memory.
15 B = "changed"; // modify the string to create a new memory location in the managed memory
16 console. writeline ("describes the demo result of modifying string to create a new instance:" + (object) A = (object) B ));
17 B = "simple string"; // at this time, the location of variable B in the managed memory is still different from that of variable.
18 console. writeline ("indicates the demo result of only determining the value when string is equal:" + (A = B ));
19 console. Readline ();






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.