using UnityEngine;
using System.Collections;
public static class IntegerExtension
{
public static int Square(this int myInt){
return myInt * myInt;
}
public static int Power1(this int myInt, int exponet)
{
int result = myInt;
for ( int i = 0; i < exponet; i++ ){
result = result * myInt;
}
return result;
}
public static int Add(int a, int b)
{
return a + b;
}
public static string NewAdd1(this string a, string b)
{
return a + " " + b;
}
}
public class Extansed : MonoBehaviour {
// Use this for initialization
void Start () {
int myInt = 2;
print (myInt.Square());
print (myInt.Power1(3));
string a = "hobbang";
print (a.NewAdd1("dfd"));
}
// Update is called once per frame
void Update () {
}
}
'Computer Language > 유니티' 카테고리의 다른 글
로그 찍기 (0) | 2014.05.13 |
---|---|
문자열 거꾸로 찍기 (0) | 2014.05.13 |
얕은 복사와 깊은 복사 (0) | 2014.05.12 |
out 을 이용하여 메인에서 배열을 써봅시다. (0) | 2014.05.09 |
원 구 실린더 계산 하기. base()사용법 (0) | 2014.05.09 |