.NET/C# Basic 썸네일형 리스트형 C# Delegate와 Event 중요 모르겠으니까 예제 외우자 낄낄낄~~~!!! [8.Delegate와 Event예제 \ delegate.cs] using System; class MainApp { public delegate void Mix(string s); // 델리게이트 선언 public static void Coffee(string s) { Console.WriteLine("this Coffee is Mixed with {0} ", s); } public static void CoCoa(string s) { Console.WriteLine("this CoCoa is Mixed with {0} ", s); } public static void Main() { Mix Tea = new Mix(Coffee); //할당된 델리게이트는 Co.. 더보기 Console.Read() 와 Console.ReadLine() 차이 using System; class whileTest { public static void Main() { bool ugiy = false; bool fool = false; Console.WriteLine("정신 교정 프로그램"); while (!(ugiy && fool)) { Console.WriteLine("당신은 잘생겼습니까? y/n"); if(Console.ReadLine() == "n") // 더보기 흐름 제어 예제 기본문법 if for while swich foreach break continue using System; class GenderTest { public static void Main() { Console.WriteLine("아유보이? (y)/(n)"); char gender = (char)Console.Read(); if( gender == 'y') Console.WriteLine("남자이시군요"); else if (gender == 'n') Console.WriteLine("여자이시군요"); else Console.WriteLine("잘못된 성별을 입력하셨습니다"); } } using System; class cyon { public static void Main() { Console.WriteLine("요일을 입력하세요"); char day = (char)Console.Read(.. 더보기 C#을 시작하기위한 .... 오윤이의 그것 구구단 을 이용해서 중첩 for문에 대해서 이해한다. using System; class ForTest { public static void Main() { for(int i=2; i 더보기 연산자 오버로딩 - 인덱스 class Point { public int x; public int y; public Point(int x, int y) { this.x = x; this.y = y; } public override string ToString() { //(x,y)값 return String.Format("({0},{1})",x,y); } // + 연산자 메서드 public static Point operator +(Point pt1, Point pt2) { return (new Point(pt1.x + pt2.x, pt1.y + pt2.y)); } // - 연산자 메서드 public static Point operator -(Point pt1, Point pt2) { return (new Point(pt1.x - p.. 더보기 C# 사용 개념 대충 순서 대충보는거 대충 ///////////////////////////////// 콘솔 ////////////////////////////////////// using System; using System.Collections.Generic; using System.Text; using Calculator; // 추가~~~ namespace ConsoleApplication37 { class Program { static void Main(string[] args) { int i = int.Parse(Console.ReadLine()); int j = int.Parse(Console.ReadLine()); Cal c1 = new Cal(); int k = c1.Add(i,j); int o = c1.Minus(i,j); } }.. 더보기 C# 정정맴버 정적 메서드 메서드에도 정적(static)으로 적용할 수 있다 정적 메서드는 주로 정적 데이터 멤버를 다룰 때 사용 public static string GetInstCount() { // 정적(static) 데이터를 다룬다. } 정적 메서드에서는 인스턴스(instance)를 다룰 수 없기 때문에 다음과 같은 몇 가지 제약이 있정적 멤버만 사용할 수 있고, 인스턴스 변수나 메서드는 사용할 수 없다. 정적 메서드에서 this 키워드를 쓸 수 없다 인스턴스 메서드에서는 인스턴스 멤버와 정적 멤버를 둘 다 사용할 수 있다 정적 멤버는 클래스에 하나만 정의되는 멤버로, 모든 인스턴스에서 공유되는 멤버 class Point { // 생성자 정의 public Point() { nInstance++; // 인스턴스 .. 더보기 클래스 관련 예제 //////// 우리가 이런예제를 보고 따라치면 자동으로 코딩도하면서 이해가되지요~ 책보다는쉽게합시다 //////// using System; class Profile { private int Age = 23; private string Name = "전광식"; private string Phone = "333-5765"; public void PrintInfo() { Console.WriteLine("{0}",Name); Console.WriteLine("{0}",Age); Console.WriteLine("{0}",Phone); } } class Access { public static void Main() { Profile my = new Profile(); my.PrintInfo(); } } us.. 더보기 이전 1 2 3 4 5 6 7 8 9 다음