70. 암시적으로 형식화된 로컬 변수
.NET프로그래밍/C# 3.5 SP1 2009. 8. 17. 11:44 |using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 암시적으로형식화된로컬변수
{
class Program
{
static void Main(string[] args)
{
// 변수 선언
int a = 10;
// Nullable 형식
int? b = null; //
// 암시적으로 형식화된 로컬 변수
var i = 1234; // 알아서 초기화되는 값으로 선언
var s = "1234";
// 타입 출력
Console.WriteLine("{0}", i.GetType()); // Int32
Console.WriteLine("{0}", s.GetType()); // String
}
}
}
'.NET프로그래밍 > C# 3.5 SP1' 카테고리의 다른 글
72. 변환연산자 (0) | 2009.08.17 |
---|---|
71. 반복기(Iterator) (0) | 2009.08.17 |
69. 분할클래스(partial class) (0) | 2009.08.17 |
68. 추가연산자 ( is / as / ?? 연산자 ) (0) | 2009.08.17 |
67. 값형식과 참조형식(Boxing과 UnBoxing) (0) | 2009.08.17 |