분류 전체보기78 [C#]LINQ연습문제(레코드조회) 다음과 같은 배열에서 Cost는 50 이상,MaxSpeed는 150이상인 레코드만 조회하는 LINQ를 작성 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp13 { class Program { class Car //프로필 클래스 { public int Cost { get; set; } //객체 생성 public int MaxSpeed { get; set; } } static void Main(string[] args) { Car[] cars = { new Car(){Cost=56,MaxSpeed=120}, new.. 2020. 6. 12. [C#]LINQ 데이터 질의 기능 숫자배열로 부터 짝수만을 추출하여 출력 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp13 { class Program { static void Main(string[] args) { //숫자배열로 부터 짝수만을 추출하여 출력 int[] numbers = { 9, 2, 6, 4, 5, 3, 7, 8, 1, 10 }; var result = from n in numbers where n % 2 == 0 //짝수를 만족하는 조건설정 orderby n //n을 정렬하고 select n; //n을 조.. 2020. 6. 12. [C#]대리자의 이벤트 1.대리자선언(클래스 안 또는 밖) 2.클래스 내에 선언한 대리자의 인스턴스를 event한정자로 수식해서 선언함 3.이벤트 핸들러 작성 4.클래스의 인스턴스 생성하고 이벤트 핸들러를 등록 5. 이벤트가 발생하면 이벤트 헨들러가 호출됨 using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; namespace ConsoleApp12 { class Program { delegate void EventHandler.. 2020. 6. 12. [C#]대리자 체인 : 여러개의 메소드를 동시에 참조할 수 있음 using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; namespace ConsoleApp12 { class Program { delegate void ThereIsAsFire(string location); //ThereIsAsFire 대리자 선언 static void Call119(string location)//메소드선언 { Console.WriteLine.. 2020. 6. 12. 이전 1 ··· 13 14 15 16 17 18 19 20 다음