C#/개인공부

C#/개인공부

LINQ 복습

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; using static reviewAll01.Earth; //using static reviewAll01.Earth; // 2022기능으로 알아서 클래스를 가져오더라 namespace reviewAll01 { class App { int[] testSets = { 1, 2, 3, 4, 5, 6, 7 }; List lists = new List(); public App() { var testSets1 = from testset in testSets.ToList(..

C#/개인공부

Func 대리자 & Action 대리자 복습

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; using static reviewAll01.Earth; //using static reviewAll01.Earth; // 2022기능으로 알아서 클래스를 가져오더라 namespace reviewAll01 { class App { int sum; int sum1; public App() { //func 문 사용 Func func1 = (x, y) => x + y; // func 대리자 선언 후 매개변수 + 식 대입 ("," 빼먹지 말것) Console.Writ..

C#/개인공부

변하지 않는 데이터 역직렬화 복습

App Class using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; using Newtonsoft.Json; namespace Study000 { class App { public App() { //json 문자열화 후 객체화하는 기본 과정 복습 string path = "./item_data.json"; //경로를 담을 변수 초기화 string jason = File.ReadAllText(path); //json파일을 불러와 string형식으로 변경 Console.WriteLine(jason); // 불러온 파일이 맞..

C#/개인공부

람다식 & 문 복습

App Class using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; using static reviewAll01.Earth; //using static reviewAll01.Earth; // 2022기능으로 알아서 클래스를 가져오더라 namespace reviewAll01 { class App { //람다문 사용전 delegate 선언 (대리자 선언) delegate int Calculate(int x, int y); delegate void Test(); delegate string Test2(); publ..

C#/개인공부

열거형 복습

App Class using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using static reviewAll01.Earth; //using static reviewAll01.Earth; // 2022기능으로 알아서 클래스를 가져오더라 namespace reviewAll01 { class App { Earth earth = new Earth(); // 클래스 생성 public App() { //enum * 열거형식 복습 Console.WriteLine(Seasons.Summer); //Seasons 타입의변수명 출력 Console.WriteLine((..

C#/개인공부

익명 메서드와 메서드 대리자 호출을 이용하여 이름 나이 출력메서드 만들기

App Class using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study10 { //2. 대리자 형식 정의 delegate void MyDel(string name , int age); class App { //생성자 public App() { //1. 이름과 나이를 매개변수로 전달받아 "이름 :□□□" "나이 :□□" 라고 출력 하는 메서드 //3. 대리자 익명 메서드 생성 후 변수 정의 -> 매개변수 값 할당 -> 메서드 실행 -> 대리자호출 및 인스턴스화 //4. 메서드연결 후 메서드 실행 Name_Age(delegate..

C#/개인공부

for문을 이용한 대리자 익명메서드

App Class using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study10 { //2. 대리자 형식 정의 delegate void MyDel(int studentNum, string name, int age); class App { //생성자 public App() { int[] studentNums = { 100, 201, 305, 422, 565 }; //학번이 들어갈 배열 작성 string[] names = { "제임스", "탈리", "가브리엘", "토이", "미유" }; //이름이 들어갈 배열 작성 int[] ages..

C#/개인공부

대리자 익명 메서드 복습 나누기 메서드 작성

App Class using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study10 { class App { delegate int MyDel(int x, int y); //2. 대리자 형식 정의 //생성자 public App() { //1. 머리속으로 생각한다 ( 두 수를 나누어주는 메서드를 생각 ) //3. 대리자 변수 정의 MyDel mydel; //4. 대리자 인스턴스화(메서드연결) //익명 메서드 mydel = delegate (int a, int b) { return a / b; }; //5. 대리자 호출 , callbac..

C#/개인공부

Hero 외부 Class의 메서드에서 두개의 메서드를 대리자로 호출

App Class using System; namespace Study10 { class App { //생성자 public App() { //2가지 방법으로 메서드를 호출함 //1. 대리자 호출 기능을 포함한 Hero Class 메서드 호출 Hero hero = new Hero("홍길동"); //Hero Class 생성 hero.AttackAndMove("홍길동"); //AttackAndMove 메서드를 사용하여 두가지 메서드를 불러옴 //2. 히어로 클래스의 대리자를 호출하여 대리자 호출 기능을 포함한 Hero Class 메서드 호출 Hero.MyDel method; // 히어로 클래스의 대리자 변수명 정의 method = new Hero.MyDel(hero.AttackAndMove); //변수에 대리..

Bueong_E
'C#/개인공부' 카테고리의 글 목록