C#프로그래밍 64

엑셀데이터를 JSON, JSON online viewer

https://jsonviewer.stack.hu/ Online JSON Viewer jsonviewer.stack.hu 객체 { "name":"홍길동" } 배열 [ { "name": "장검", "damage": 12 }, { "name": "단검", "damage": 9 } ] https://shancarter.github.io/mr-data-converter/ Mr. Data Converter shancarter.github.io 1.엑셀 파일 만든다 2. Mr.Convert가서 엑셀 데이터를 JSON문자열로 변환 3. Json Onlinve Viewer 유효성 체크 + 타입 객체 제거 4. JSON 문자열 복사 후 메모장에 item_data.json으로 저장 5. 내 visual studio 파일 ..

C#프로그래밍 2023.07.27

람다, Action<T> , Func<T>

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FakeInventory { public class App { //1. 대리자 형식 정의 delegate void MyDel(); //생성자 public App() { //2. 대리자 인스턴스화 (람다/무명메서드 연결) MyDel del = () => { Console.WriteLine("안녕하세요"); }; //3. 대리자 사용 del(); } } } using System; using System.Collections.Generic; using System.Linq; using ..

C#프로그래밍 2023.07.27

대리자, 무명메서드

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FakeInventory { public class App { //변수 정의할 때 값 //메서드 정의 기능 생각 //메서드에 대한 참조를 가질 수 있는 형식 //한정자 delegate 형식명 연결할메서드시그니쳐 //2. 대리자 형식 정의 delegate void MyDelegate(); //생성자 public App() { //3. 대리자 인스턴스 생성 및 연결 (대리자 초기화) MyDelegate myDel = new MyDelegate(this.SayHello); //4. 대리자..

C#프로그래밍 2023.07.27

List, Dictionary 복습

List using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FakeInventory { public class App { //생성자 public App() { //컬렉션을 사용할 때 : 개체를 그룹화하고 관리할 때 (배열/컬렉션) //List //인스턴스생성 //아이템 이름들을 관리하는 컬렉션 List itemNames = new List(); //추가 itemNames.Add("장검"); itemNames.Add("장검"); //중복 허용 itemNames.Add(null); // null도 허용 //itemNames.Add(12..

C#프로그래밍 2023.07.27

과제

싱글톤은 단순한 프로그램을 만드는데 적합한 기능같다. 복잡한 것을 하려면 디자인패턴의 추가가 필요하고 아니라면 싱글톤으로 단순하게 모든 데이터를 관리할 수 있어서 편리할 것 같다. 디자인패턴은 싱글톤으로 못하는 단순하지 않고 복잡한 프로그램들을 관리하는데 좋은 기능같다. 패턴들이 다양한데 조상님으로부터 내려온 수많은 시행착오에서 나타난 디자인패턴들로 다 효율적인 패턴들 같다. dictionary는 왜 검색이 빠른가?? 저장할 때 key 값에 해시 함수를 적용해 고유한 index 를 만들어 저장하기 때문

C#프로그래밍 2023.07.26

컬렉션 [제네릭 - List<T>, Dictonary <TKey, TValue>, Queue<T>, Stack<T>]

1. 제네릭 List : 인덱스로 액세스할 수 있는 개체 목록을 나타냅니다. 목록의 검색, 정렬 및 수정에 사용할 수 있는 메서드를 제공합니다. using System; using System.Collections; using System.Collections.Generic; namespace Game2048 { public class App { //생성자 public App() { //동적 배열 //리스트 형식 변수 정의 List itemNames; //컬렉션 인스턴스화 == 리스트 인스턴스화 itemNames = new List(); //요소에 값을 할당 //itemNames.Add(1234); itemNames.Add("장검"); Console.WriteLine(itemNames.Count); //..

C#프로그래밍 2023.07.26

namespace, 컬렉션[ArrayList, Hashtable, Stack, Queue]

namespace 키워드는 관련 개체 집합을 포함하는 범위를 선언하는 데 사용됩니다. 컬렉션 1. ArrayList [비선호, for문 O, 배열임] , 동적 배열이다. using System; using System.Collections; namespace Game2048 { public class App { //생성자 public App() { //None-Generic Collection Class //네임스페이스 : System.Collections //ArrayList : 동적 배열 //컬렉션 인스턴스화 ArrayList list = new ArrayList(); //요소를 추가한다 list.Add("홍길동"); list.Add(123); list.Add(new Item()); int[] arr..

C#프로그래밍 2023.07.26