예제) 형 변환

 

 

 

 

using System;

class TypeCast03

{

  public static void Main()

  {

  short value1 = 100;

  int   value2 = value1;  //ß(1)

  int   value3 = 50000;

  //short value4 = value3;  //ß(2)

  short value4 = (short) value3;  //ß(3)

  Console.WriteLine("Short : {0}",value4);  //ß(4) 

  }

}

 

 

 

 

 

+ Recent posts