C# string 타입

    [C#] 값 타입 vs 참조 타입(2)

    [C#] 값 타입 vs 참조 타입(2)

    1. int (System.Int32) using System; class Program { public static void Main() { // int n = new int(); int n1 = 1; int n2 = n1; n2 = 10; Console.WriteLine(n1); } } int는 값 타입일까? 참조 타입일까? 값 타입이라면 n2는 10이 될 것이고, 참조 타입이라면 n2는 1이 될 것이다. int의 정의를 따라가면 int는 struct로 만들어 진것을 볼 수 있다. 따라서 값 타입으로 n2는 10이 된다. 2. array (System.Array) using System; class Program { public static void Main() { int[] arr1 = {1, 2,..