반응형

C#/수업과제 16

0323_ 람다식 연습

1. Action 델리게이트 생성 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace study8 { public class App { public App() { //대리자 초기화 Action hello = this.SayHello; //대리차 호출 hello(); } private void SayHello() { Console.WriteLine("Say hello!"); } } } ---- 2.익명과 람다식으로 대리자 초기화 -> 호출 using System; using System.Collections.Generic; using ..

C#/수업과제 2021.03.24

0322_ delegates 연습

1- 드라군 생성이 다 되었으면 사운드 나오기 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace study10 { public delegate void OnCreateUnit(); public class Dragoon { public OnCreateUnit createUnit; public Dragoon() { } public void CreateUnit() { Console.WriteLine("드라군이 생성됩니다."); this.createUnit(); } } } using System; using System.Collection..

C#/수업과제 2021.03.22

0318_ArrayList, List<T>, Dictionary 예제 연습

Array List using System; using System.Collections; namespace study06_Hw { public class App { public App() { Console.WriteLine("Hello World"); //ArrayList 변수 선언 ArrayList fruits; //ArrayList 객체 생성 fruits = new ArrayList(); //ArrayList 에 요소 추가 fruits.Add("사과"); fruits.Add("포도"); fruits.Add("사과"); fruits.Add(5.0f); fruits.Add(true); fruits.Add(null); //ArrayList의 모든 요소 제거 //fruits.Clear(); //ArrayL..

C#/수업과제 2021.03.19

6일차 _ 인벤토리

다 만들지는 못했고, 아이템 검색까지 만들었습니다 ㅠㅠ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace study05 { class App { public App() { Inventory inventory = new Inventory(5); Item item = new Item("강철",Item.eItemType.POTION); inventory.Additem(item); item = new Item("사슬갑옷", Item.eItemType.ARMOR); inventory.Additem(item); inventory.FindIte..

C#/수업과제 2021.03.16
반응형