์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
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 |
- ๋์ ํ๋ก๊ทธ๋๋ฐ
- Flutter
- ํ์ด์ฌ
- c#
- Java
- ํ๋ก๊ทธ๋๋จธ์ค
- ์๋ฐ์คํฌ๋ฆฝํธ
- ๋ฐฑ์ค
- ๋ชป๊ทธ๋ฆฌ์ง๋ง
- BFS
- ๊ทธ๋ํ ํ์
- JavaScript
- ์ฐ์ จ์์
- JS
- DART
- ๊ตฌํ
- DP
- programmers
- ์ด์งํ์
- ์คํฐ๋
- ์ผ์ฑsw์ญํ
- ์๊ณ ๋ฆฌ์ฆ
- Algorithm
- BAEKJOON
- sort
- ์๋ฃ๊ตฌ์กฐ
- ์ฝ๋ํธ๋ฆฌ
- ๋ฌธ์์ด ํ์ฑ
- ์นด์นด์ค
- ์ฝ๋ฉํ ์คํธ
- Today
- Total
๋ชฉ๋ก๐ป Programming Language/C# (51)
Algo ์ฐ์
C# ์ ์ฌ์ฉํ๋ ์ด์ !!! ์ํํธ์จ์ด ์ ๋ขฐ์ฑ ํ ์คํ ์ ํ๊ธฐ์ํด ์ํํธ์จ์ด ์ ๋ขฐ์ฑ ํ ์คํ ์ ์์ด ํ ์ธ์ด๋ค๋ ์ฌ์ฉํ ์ ์์ง๋ง C#์ ๋นํด ์ฌ์ฉํ๊ธฐ ์ด๋ ต๊ฑฐ๋ ๋ณต์กํจ Window ๊ธฐ๋ฐ ์ ํ๋ฆฌ์ผ์ด์ ์ ์ ์ํ ๋ C++, C#, Java ๋ฑ์ ์ฌ์ฉํ๋๋ฐ ์ ๋ขฐ์ฑ์ํ ๋ฉด์์ C#์ ์ฌ์ฉํ๋๊ฒ ์ด์ ์ด ์๋ค. ๋ฌด์๋ณด๋ค๋ ์๋์ฐ ์ ํ๋ฆฌ์ผ์ด์ ๊ฐ๋ฐ์ธ์ด๋ก๋ ์ต์ ! ์ถ๊ฐ์ ์ผ๋ก ์์ฐ์ฑ์ด ์ข๋ค๋ ์ธก๋ฉด๋ ์๋ค. UI๋ฅผ ์์๊ฒ ํด์ฃผ๋ ํด๋ ์๊ธฐ ๋๋ฌธ ๋๊ธฐํ์ ์์ด ๋ค๋ฅธ ๋ฉ์๋์๋ lock ์ถ๊ฐ! Output ๋งค๊ฐ๋ณ์๊ฐ ์๋ ์ค๋ ๋ ๊ฐ์ฒด ์์ฑํด๋ณด๊ธฐ Output ๋ณ๋ ฌ์ฒ๋ฆฌ vs ๋ถ์ฐ์ฒ๋ฆฌ ๋ณ๋ ฌ์ฒ๋ฆฌ ํ๋์ ์์ (work)๋ฅผ ๋๋ ์ ์ฒ๋ฆฌํ๋ค. Divide & Merge ๊ฐ๊ฐ์ ์ค๋ ๋๊ฐ ์ฒ๋ฆฌํ๋ ๋ก์ง์ด ๊ฐ์๊ฒฝ์ฐ์ ์ฌ์ฉ ํ์ฌ ์์คํ ์์๋ ๊ฑฐ์ ์ฌ..
๊ณผ์ [๊ตฌํ๋ด์ฉ] ์ ๋ ฅ Thread ๋ ์์ ์์์ ์์ ๋ด์ฉ์ ์ฒ๋ฆฌ Thread๋ก ์ ๋ฌํ๊ณ ์ฒ๋ฆฌ Thread๋ ์์ ์์๋ฅผ ๊ธฐ์ค์ผ๋ก ์์ ๋ด์ฉ์ ์ ๋ฆฌํ์ฌ ์ถ๋ ฅ ์กฐ๊ฑด ์ ๋ ฅ Thread 2๊ฐ Thread ๋ฏธ๋ฆฌ ์ ์๋ ํ์ผ ์ ์ฝ์ด์ ์ฒ๋ฆฌ Thread๋ก ์ ๋ฌ ํ์ผ์ ๋ค ์ฝ์ผ๋ฉด Thread ์ข ๋ฃ ์ฒ๋ฆฌ Thread 1๊ฐ Thread ์ ๋ ฅ Thread์ ๊ณตํต์ ์ผ๋ก ์ฌ์ฉํ List ์์ฑ ์ฒ์ ์์ ์ด ์ ๋ ฅ๋ ๋ ๊น์ง ์ฒ๋ฆฌ ์์ ์ ์งํํ์ง ์์(์ฒ์ ์์ ๋ฒํธ 0) ๋ง์ง๋ง ์์ ์ด ์ ๋ ฅ๋๋ฉด Thread ์ข ๋ฃ (9๋ฒ ์์ ์ด ์ ๋ ฅ๋๋ฉด ์ข ๋ฃ) ๊ตฌํ ์ฝ๋ using System; using System.IO; using System.Collections.Generic; using System.Threading.Tasks; na..
์ด๋ฒคํธ ๋ฐ์ดํฐ๋?!!? public delegate void EventHandler(object sender, EventArgs e); Public delegate void EventHandler(object sender, TEventArgs e); public delegate void EventHandler(object sender, EventArgs e); ์ด๋ฒคํธ ๋ฐ์ดํฐ๊ฐ ์๋ ์ด๋ฒคํธ๋ฅผ ์ฒ๋ฆฌํ ๋ฉ์๋๋ฅผ ๋ํ๋ Public delegate void EventHandler(object sender, TEventArgs e); ์ด๋ฒคํธ๊ฐ ๋ฐ์ดํฐ๋ฅผ ์ ๊ณตํ ๋ ์ด๋ฒคํธ๋ฅผ ์ฒ๋ฆฌํ ๋ฉ์๋๋ฅผ ๋ํ๋ ์ด๋ฒคํธ ๋ฐ์ดํฐ๋ฅผ ์ค๋ช ํ๊ธฐ ์ํด ๋๋ฒ์งธ ์ธ์๋ก ์๋ e ์ ๋ํด์ ์์๋ณด๋ฉด 1 ๋ฒ ๋ฉ์๋์ ๊ฒฝ์ฐ ๋๋ฒ์งธ e ๊ฐ์ฒด๋ ์ด๋ฒคํธ์..
catch ์์ ๋ค์ฃฝ๋ฐ์ฃฝํด์ ํ์ธ class Program { class A { public int field; public static int getField(A obj) { return obj.field; } } static void Main(string[] args) { try { // DivideByZeroException int a = 10; int b = 0; Console.WriteLine(a / b); // NullReferenceException A obj = null; Console.WriteLine(A.getField(obj)); // IndexOutOfRangeException int[] arr = { 1, 2, 3 }; for (int i = 0; i < 4; i++) { Cons..
ํ๋ณํ๊ณผ ๊ด๋ จํ์ฌ ... as ์ฐ์ฐ์๋ ์ฐธ์กฐํ์๋ง ์ฌ์ฉ์ด ๊ฐ๋ฅํ๊ณ ๊ธฐ๋ณธ ๊ฐํ์์๋ ์ฌ์ฉ์ด ๋ถ๊ฐ๋ฅํ๋ค. ๊ธฐ๋ณธ ๊ฐ ํ์์๋ int, byte, char, long ... ๊ธฐ๋ณธ ๊ฐ ํ์์ nullable => ? ํค์๋๋ ์ ์ธ๋ฌธ์ ๋ค์ด๊ฐ๋ ํค์๋์ด๊ธฐ์ ์ฌ์ฉ๊ฐ๋ฅ int => value ํ์ INTEGER => reference ํ์ string ์ ๊ธฐ๋ณธ ์ฐธ์กฐํ์ด๋ผ๊ณ ๋ฌธ์์ ๋์ค๋๋ฐ ์ ์๋ ๊น?? string์ ์ฐธ์กฐ ํ์์ด์ง๋ง string๋ ์ฐธ์กฐ๊ฐ ์๋๋ผ string ๊ฐ์ฒด์ ๊ฐ์ ๋น๊ตํ๋๋ก ์ ์๋๋ค String ๊ณผ string ์ ์ฐจ์ด๋ ์๋ค. ๋ค๋ง string์ด System.String ํด๋์ค๋ฅผ ์์๋ฐ์ ๊ตฌ์ฑ๋์๋ค. ๋ณดํต string ์ ์ฌ์ฉํ ๊ฒ์ ๊ถ์ฅํ๊ธดํ๋ค. string a = "hello"; string..
sealed ํค์๋๋ฅผ ๋ฉ์๋์ ์ฌ์ฉ! ๋ถ๋ชจํด๋์ค์์ ์ค์๋์ ํ๊ฒ๋ ํ๋ ์์์ ์์ํด๋์ค์์ ๊ฑด๋๋ฆฌ๋ฉด ์๋๋ ๊ฒฝ์ฐ ๋ฉ์๋์ sealed ํ์ ์๋ฅผ ์ฌ์ฉํด์ ์ ํํ ์ ์๋ค. class Parent { public int num; public int count; public Parent(int num) { this.num = num; this.count = 0; Console.WriteLine("Parent ์์ฑ์"); } public virtual void addCount() { } public void showInfo() { Console.WriteLine("Num : {0}, Count : {1}", this.num, this.count); } } class Counter : Parent { publ..
1. ์ฐธ์กฐ ํ์์ ๋ฉ์๋์ ๋งค๊ฐ๋ณ์๋ก ๋๊ฒจ ํ ๋น ํ ๋ณํ๋ฅผ ์ฃผ๋ฉด ์ด๋ป๊ฒ ๋ ๊น? class MyField { public int field1; public int field2; } class AssignRefType { public static void addVal(MyField obj) { MyField temp = obj; temp.field1++; temp.field2++; } public static void subVal(MyField obj) { MyField temp = obj; temp.field1--; temp.field2--; } static void Main(string[] args) { MyField mf = new MyField() { field1 = 1, field2 = 2 }; M..