본문 바로가기
728x90

C#50

[ C# 8일차 ] 오버라이딩 App Class using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections; namespace Study09 { class App { //생성자 public App() { Console.WriteLine("App"); Marine marine = new Marine(); Firebat firebat = new Firebat(); marine.Attack(); firebat.Attack(); } } } TerranUnit Class using System; using System.Collections.Generic.. 2023. 1. 10.
[ C# 8일차 ] Collection 연습_List, Queue, Stack // 컬렉션 생성 //Add //Contains //단일 요소값 가져오기 //Remove //Count //for //foreach List using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections; namespace Study09 { class App { //생성자 public App() { Console.WriteLine("App"); // 컬렉션 생성 List weapons = new List(5); //Add Weapon weapon0 = new Weapon("장검"); weapons.Add(weapon0.. 2023. 1. 10.
[ C# 8일차 ] Generic 일반화 Class using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections; namespace Study09 { class App { //생성자 public App() { Console.WriteLine("App"); Inventory inventory = new Inventory(10); inventory.AddItem(new Weapon()); Inventory inventory1 = new Inventory(10); inventory1.AddItem(new Armor()); } } } using System; using Sy.. 2023. 1. 10.
[ C# 8일차 ] Generic 일반화 메서드 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections; namespace Study09 { class App { //생성자 public App() { Console.WriteLine("App"); int[] arr0 = { 1, 2, 3 }; int[] arr1 = new int[3]; string[] arr2 = { "t", "r", "e" }; string[] arr3 = new string[3]; CopyArray(arr0, arr1); CopyArray(arr2, arr3); Hero[] arr4 = .. 2023. 1. 10.
[ C# 8일차 ] Struct 구조체 App Class using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections; namespace Study09 { class App { //생성자 public App() { Point3D point3d; Console.WriteLine("App"); //Console.WriteLine(point3d); point3d.x = 10; point3d.y = 10; point3d.z = 10; Console.WriteLine("{0} {1} {2}",point3d.x, point3d.y, point3d.z); Point3.. 2023. 1. 10.
[ C# 8일차 ] Collections_Hashtable 키와 값을 같이 저장! using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections; namespace Study09 { class App { //생성자 public App() { Console.WriteLine("App"); //컬렉션 인스턴스 생성 Hashtable table = new Hashtable(); table.Add(100, "홍길동"); //table.Add(100, "임꺽정"); //키 중복 불가. 에러 table.Add(102, new Hero()); table.Add("aaa", 1000); t.. 2023. 1. 10.
728x90