Simple string
1 using system;
2 using system. Collections. Generic;
3 using system. text;
4
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 ();
20
21
22}
23}
24}
25
26
Result:
True
False
True