using UnityEngine;

using System.Collections;

using System;

public class chap10_4 : MonoBehaviour {

void Print(int v){

print (string.Format("{0}", v));

}

// Use this for initialization

void Start () {

int[] scores = new int[]{80, 74, 81, 90, 34, 90} ;

foreach(int s in scores)

print (string.Format("{0}", s));

Array.Sort(scores);

Array.ForEach<int>(scores, new Action<int>(Print));

print(string.Format("number of dimensions : {0}", scores.Rank));

print (string.Format("linear Search: 90 is at {0}", Array.IndexOf(scores, 90)));

print (string.Format("Reverse Search: 90 is at {0}", Array.LastIndexOf(scores, 90)));

print(string.Format("Old Length of scores : {0}", scores.Length));

Array.Resize<int>(ref scores, 10);

print(string.Format("Old Length of scores : {0}", scores.Length));

scores[6] = 22;

scores[7] = 77;

Array.ForEach<int>(scores, new Action<int>(Print));

}

// Update is called once per frame

void Update () {

}

}




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

이차원 배열 선언과 동시에 초기화  (0) 2014.05.16
find 함수  (0) 2014.05.16
c# array  (0) 2014.05.16
int[] a -> System.Array  (0) 2014.05.16
using 사용법  (0) 2014.05.16

+ Recent posts