using UnityEngine;

using System.Collections;


public class Chap3 : MonoBehaviour {


// Use this for initialization

void Start () {

byte a = 250;   //0~255

short b = a;       //-32765 ~ 32765

ushort c = 2000; //65535

sbyte d = (sbyte)c;         //-128~127 

print("b =" + b);  

print ("d=" + d);

}

// Update is called once per frame

void Update () {

}

}

가지고 있는 값보다 크다면 형변환을 해줘야 함. 하지만 그 값은 범위내에 있어야 제대로 표현됨.

범위내에 없다면 다른 값을 리턴

'Computer Language > 유니티' 카테고리의 다른 글

배열  (0) 2014.03.31
C# String Format  (0) 2014.03.31
boolean  (0) 2014.03.31
이스케이프 문자  (0) 2014.03.31
문자형  (0) 2014.03.31

+ Recent posts