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 () {

}

}



+ Recent posts