|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 값타입과참조타입
{
class Program
{
static void Main(string[] args)
{
//값형식 : value Type : 닷넷이 관리하는 메모리의 스택에 보관
int i = 1234;
//참조 형식 : Reference : 닷넷의힙 메모리에 보관
string s = "안녕\0하세요"; //리터럴(Literal)
Console.WriteLine("{0}",s);
//박싱Boxing과 언박싱UnBoxing
string su = "1234";
int num = Convert.ToInt32(su); // 힙 -> 스택 : 언박싱 ~
su = i.ToString(); //스택 -> 힙 :Boxing
su = null; //가비지 컬렉터 엔진 활동
//구조체는 값형식, 클래스 참조형식
}
}
}
'.Net Project > .Net C#' 카테고리의 다른 글
85장 추가연산자 (0) | 2009.08.17 |
---|---|
84장 박싱&언박싱(boxing Unboxing) (0) | 2009.08.17 |
82장 널값표현(Nullable) (0) | 2009.08.17 |
81장 명령인수갯수 (0) | 2009.08.17 |
34. Sort 선택정렬 Ex) (0) | 2009.08.10 |