달력

02

« 2012/02 »

  •  
  •  
  •  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  •  
  •  
  •  

'Nullable Type'에 해당되는 글 1

  1. 2008/11/30 Nullable 타입
2008/11/30 00:04

Nullable 타입 General .NET2008/11/30 00:04


.NET Framework CTS(Common Type System)에 정의된 타입

- 값 타입(Value Type), 참조 타입(Reference Type)

- 이전에는 값 타입에 Null을 할당할 수 없었다.

- C#2.0에서는 값 타입에도 Null 저장이 가능해짐.(Nullable 타입)

- 컬럼의 타입이 정수형이므로 Null을 입력할 수 있도록 프로그램으로 처리.

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleCshapStudy
{
    class MakeNullable
    {
        static void Main(string[] args)
        {
            Nullable<int> x = new Nullable<int>(123);
            if (x.HasValue)
            {
                Console.WriteLine(x.Value);
            }
        }
    }
}

저작자 표시 비영리 변경 금지

'General .NET' 카테고리의 다른 글

세티가 정리한 VB.NET(1)  (2) 2008/11/30
익명 메서드(Anonymous Methods)  (0) 2008/11/30
Nullable 타입  (0) 2008/11/30
DataTable.NewRow  (0) 2008/11/30
닷넷2.0을 시작하며...  (0) 2008/07/22
세티의 닷넷강좌를 다시 살리겠습니다.  (0) 2008/07/22
Posted by -세티-