RSS

C# / Keyword / as

02 Jan

as 키워드는 객체를 다른 Type으로 변환하여 줍니다.

TypeA varA = (TypeA) varB 문법과 비슷지만,

호환이 되지 않는 Type 이라면 null을 리턴합니다.

 foreach(object obj in strings) { 
 string str = obj as string; 
 if(str != null) { 
 UnityEngine.Debug.Log("String : " + str); 
 } 
 } 
 
Leave a comment

Posted by on January 2, 2012 in C#

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: