IEnumerable ๊ฐ์ ๋ฐ๋ผํ๋ ์ค ์ง๋ฌธํฉ๋๋ค.
(์ฌ์ง)๊ฐ์ 21๋ถ 35์ด ๋ณด๊ณ ๋ ๋ฐ๋ผํ๋๋ฐ๋ ๋๊ฐ์ต๋๋ค.ใ
ใ
using System;using System.Collections;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Exam11_1{ class Exam11_1 { public void Run() { TestBasic(); //TestStudent(); } private void TestStudent() { Student[] students = new Student[] {new Student("ํ๊ธธ๋", 89, 1), new Student("ํฉ์ง์ด", 87, 2)}; IEnumerator enumerator = students.GetEnumerator(); while (enumerator.MoveNext()) Console.WriteLine(enumerator.Current); } private void TestBasic() { int[] intArray = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; //for (int i = 0; i //IEnumerator enumerator = intArray.GetEnumerator(); //while (enumerator.MoveNext()) //{ // Console.WriteLine(enumerator.Current); //} //foreach() //foreach (int i in intarray) Console.WriteLine(i); string str = "abcdefg"; foreach (char c in str) Console.WriteLine(c); } } class Student { public string Name { get; set; } public int Score { get; set; } public int Id { get; set; } public Student(string name, int score, int id) { Name = name; Score = Score; Id = id; } public override string ToString() { return $"{Name}[{Id}][{Score}]"; } }}