Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 재귀
- 오류
- python
- Algorithm
- DP
- 기초
- w3school
- Tutorial
- Unreal Engine 5
- Class
- Basic
- guide
- c++
- 프로그래밍
- 백준
- dfs
- C#
- 시작해요 언리얼 2022
- String
- Material
- Programming
- UE5
- loop
- dynamic
- W3Schools
- github
- parameter
- 파이썬
- 문제풀이
- Unity
Archives
- Today
- Total
행복한 개구리
C# 21.03.29.수업내용 본문
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Diagnostics;
namespace Study801
{
class App
{
public App()
{
Console.WriteLine("App");
//스레드 변수 선언
Thread t;
ThreadStart ts = new ThreadStart(() =>
{
for(int i = 0; i < 10; i++)
{
Console.WriteLine("Hello");
Thread.Sleep(500);
}
});
//스레드 인스턴스화 (ThreadStart대리자 인스턴스화)
t = new Thread(ts);
//스레드 시작
t.Start();
Thread t2 = new Thread(new ThreadStart(this.Hi));
t2.Start();
}
private void Hi()
{
for(int i = 0; i < 10; i++)
{
Console.WriteLine("HI");
Thread.Sleep(500);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Diagnostics;
namespace Study801
{
class App
{
static Thread thread1, thread2;
public App()
{
Console.WriteLine("App");
thread1 = new Thread(() =>
{
//Running : 스레드 시작 후 동작 상태
Console.WriteLine(thread1.ThreadState);
Thread.Sleep(1000);
thread1.Abort();
Thread.Sleep(1000);
thread1.Join();
});
thread1.Name = "Thread1";
//Unsterted : 스레드 생성 후 Start 되기 전 상태
Console.WriteLine(thread1.ThreadState);
thread1.Start();
thread2 = new Thread(() =>
{
while (true)
{
Thread.Sleep(100);
//WaitSleepJoin : 블록 상태, Join, Monitor Enter, Sleep일 때 되는상태
Console.WriteLine(thread1.ThreadState);
//Stopped : Abort메서드 호출시 되는 상태(중지된 스레드의 상태)
}
});
thread2.Start();
}
}
}
============================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Diagnostics;
namespace Study801
{
public class Coffee
{
}
public class Egg
{
}
public class Toast
{
public string bread;
public Toast(string bread)
{
this.bread = bread;
}
}
class App
{
public App()
{
//가변배열 선언
int[][] arr = new int[3][];
arr[0] = new int[2];
arr[1] = new int[6] { 1, 2, 3, 4, 5, 6 };
arr[2] = new int[3] { 7, 8, 9 };
int[] arr1 = arr[0];
Console.WriteLine(arr);
for(int i = 0; i < arr.Length; i++)
{
for(int j = 0; j < arr[i].Length; j++)
{
Console.WriteLine(arr[i][j] + " ");
}
Console.WriteLine();
}
}
}
}
'C# > 수업내용' 카테고리의 다른 글
C# 21.03.26.수업내용 (0) | 2021.03.26 |
---|---|
C# 21.03.25.수업내용 (0) | 2021.03.25 |
C# 21.03.24.수업내용 (0) | 2021.03.24 |
C# 21.03.23.수업내용 (0) | 2021.03.23 |
C# 21.03.22.수업내용 (0) | 2021.03.22 |