The two major data types in C
#The data types in C# are divided into two major categories: Value type and Reference type .
Value type
<code class="c#">int i = 10; int j = i; i = 20; Console.WriteLine(j); // 输出 10</code>
Reference type
<code class="c#">string s1 = "Hello"; string s2 = s1; s1 += " World"; Console.WriteLine(s2); // 输出 Hello</code>
The above is the detailed content of What are the two major types of data types in c#?. For more information, please follow other related articles on the PHP Chinese website!