[C# 8.0] ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ (1) - ๋””ํดํŠธ ์ธํ„ฐํŽ˜์ด์Šค ๋ฉค๋ฒ„, ํŒจํ„ด ๋งค์นญ
ยท
๐Ÿ“ Language/โœ C#
C# 8.0์˜ ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ ๋””ํดํŠธ ์ธํ„ฐํŽ˜์ด์Šค ๋ฉค๋ฒ„(Default Inteface Members) ํŒจํ„ด ๋งค์นญ Nullable Reference Type ์ธ๋ฑ์‹ฑ๊ณผ ์Šฌ๋ผ์ด์‹ฑ ๋น„๋™๊ธฐ ์ŠคํŠธ๋ฆผ using ์„ ์–ธ ๋„ ๋ณ‘ํ•ฉ ํ• ๋‹น์ž ๊ตฌ์กฐ์ฒด ์ฝ๊ธฐ ์ „์šฉ ๋ฉค๋ฒ„ ์ •์  ๋กœ์ปฌ ํ•จ์ˆ˜ ๋ฌธ์ž์—ด ๋ณด๊ฐ„ ํ† ํฐ๊ณผ @ ํ† ํฐ ์ˆœ์„œ Unmanaged constructed type https://www.csharpstudy.com/Latest/CS8-def-itf-mem.aspx C# 8 ๋””ํดํŠธ ์ธํ„ฐํŽ˜์ด์Šค ๋ฉค๋ฒ„ - C# ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๋ฐฐ์šฐ๊ธฐ (Learn C# Programming) C# 8 : ๋””ํดํŠธ ์ธํ„ฐํŽ˜์ด์Šค ๋ฉค๋ฒ„ ๊ตฌํ˜„ (Default Inteface Members) ์ง€๊ธˆ๊นŒ์ง€ (C# 8.0 ์ด์ „) C#์—์„œ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ํ•œ๋ฒˆ ๋ฐฐํฌํ•œ ํ›„, ๊ทธ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ..
[C# 7.0] ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ (4) - ์ข…๋ฃŒ์ž(Deconstructor), ref local, ref return
ยท
๐Ÿ“ Language/โœ C#
C# 7.0์˜ ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ 6. ์ข…๋ฃŒ์ž(Deconstructor) ์ข…๋ฃŒ์ž(Deconstructor)๋Š” ์ƒ์„ฑ์ž(Constructor)์™€ ๋Œ€์นญ์ ์ธ ๊ฐœ๋…์ด์ง€๋งŒ ํŒŒ๊ดด์ž(Destructor)์™€๋Š” ๋‹ค๋ฅด๋‹ค. ์ƒ์„ฑ์ž๋Š” ๋ณดํ†ต ์™ธ๋ถ€์—์„œ ์ž…๋ ฅ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ๋ฐ›์•„๋“ค์—ฌ ์ด๋ฅผ ํ•„๋“œ์— ์ €์žฅํ•˜๋Š” ์—ญํ• ์„ ํ•œ๋‹ค. ์ข…๋ฃŒ์ž๋Š” ํ•„๋“œ์˜ ๊ฐ’๋“ค์„ ์™ธ๋ถ€๋กœ ์ „๋‹ฌํ•˜๋Š” ์—ญํ• ์„ ํ•œ๋‹ค. ํŒŒ๊ดด์ž๋Š” ๋ถˆํ•„์š”ํ•œ ๋ฆฌ์†Œ์Šค๋ฅผ ์ œ๊ฑฐํ•˜๋Š” ์—ญํ• ์„ ํ•œ๋‹ค. namespace ConsoleApp1 { class Program { static void Main(string[] args) { BasicInfo person = new BasicInfo(1, "Lee", 10); var (id, name, age) = person; WriteLine($"{id} - {name}"); } }..
[C# 7.0] ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ (3) - out ํŒŒ๋ผ๋ฏธํ„ฐ, ๋ฆฌํ„ฐ๋Ÿด ํ‘œํ˜„
ยท
๐Ÿ“ Language/โœ C#
C# 7.0์˜ ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ 4. out ํŒŒ๋ผ๋ฏธํ„ฐ ์ด์ „ ๋ฒ„์ „์—์„œ๋Š” ๋ฉ”์„œ๋“œ ํ˜ธ์ถœ ์‹œ out ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ ๋ฏธ๋ฆฌ ์„ ์–ธ ํ›„ ์‚ฌ์šฉํ•ด์•ผ ํ–ˆ๋‹ค. ์ด๋Š” ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ๋ฌธ์žฅ ๋ฐ–์— ๋ณ€์ˆ˜๋ฅผ ์„ ์–ธํ•จ์œผ๋กœ์จ ๋ณ€์ˆ˜๊ฐ€ ์‚ฌ์šฉ๋˜๋Š” ๋ฒ”์œ„๋ฅผ ๋ช…์‹œ์ ์œผ๋กœ ์ง€์ •ํ•˜๋Š” ์ด์œ ๋„ ์žˆ์—ˆ๋‹ค. ํฐ ๋ฌธ์ œ๋Š” ์•„๋‹ˆ์ง€๋งŒ ๋ฒˆ๊ฑฐ๋กญ๊ฒŒ ๋Š๊ปด์งˆ ๋•Œ๊ฐ€ ์žˆ๋‹ค. C# 7.0์—์„œ๋Š” ๋ฉ”์„œ๋“œ ํ˜ธ์ถœ ์‹œ ํŒŒ๋ผ๋ฏธํ„ฐ ํƒ€์ž…์„ out๊ณผ ํ•จ๊ป˜ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜์˜€๋‹ค. ์ด๋ ‡๊ฒŒ ์ง€์ •๋œ ํŒŒ๋ผ๋ฏธํ„ฐ๋Š” ์ž์‹ ์„ ๋‘˜๋Ÿฌ์‹ผ ๋ธ”๋ก ๋‚ด์—์„œ๋งŒ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋‹ค. void Test() { // ์ด์ „ ๋ฐฉ์‹ //int x, y; //GetXY(out x, out y); // out ํŒŒ๋ผ๋ฏธํ„ฐ GetXY(out int x, out int y); Console.WriteLine($"{x},{y}"); } out ํŒŒ๋ผ๋ฏธํ„ฐ ..
[C# 7.0] ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ (2) - ํŠœํ”Œ(Tuple), ๋กœ์ปฌ ํ•จ์ˆ˜(Local Function)
ยท
๐Ÿ“ Language/โœ C#
C# 7.0์˜ ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ 2. ํŠœํ”Œ(Tuple) ์ด์ „ ๋ฒ„์ „์—์„œ๋Š” ๋ฉ”์„œ๋“œ์—์„œ ํ•˜๋‚˜์˜ ๊ฐ’๋งŒ์„ ๋ฆฌํ„ดํ•  ์ˆ˜ ์žˆ์ง€๋งŒ, C# 7.0์—์„œ๋Š” ํŠœํ”Œ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฉ”์„œ๋“œ๋กœ๋ถ€ํ„ฐ ๋ณต์ˆ˜ ๊ฐœ์˜ ๊ฐ’๋“ค์„ ๋ฆฌํ„ดํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ๋‹ค. ๋ฉ”์„œ๋“œ๋ฅผ ์ •์˜ํ•  ๋•Œ ๋ฆฌํ„ด ํƒ€์ž…์ด ๋ณต์ˆ˜ ๊ฐœ์ด๋ฏ€๋กœ ํŠœํ”Œ ๋ฆฌํ„ด ํƒ€์ž…(tuple return type) ํ‘œํ˜„์„ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜๋Š”๋ฐ, ์ด๋Š” ๊ด„ํ˜ธ ( ) ์•ˆ์— ์—ฌ๋Ÿฌ ๋ฆฌํ„ดํƒ€์ž…๋“ค์„ ์ˆœ์„œ๋Œ€๋กœ ๋‚˜์—ดํ•˜๋ฉด ๋œ๋‹ค. ๋ฉ”์„œ๋“œ ์•ˆ์—์„œ ์‹ค์ œ ์—ฌ๋Ÿฌ ๊ฐ’๋“ค์„ ๋ฆฌํ„ดํ•  ๋•Œ๋Š” ๊ด„ํ˜ธ ( ) ์•ˆ์— ์ฝค๋งˆ๋กœ ๋ถ„๋ฆฌํ•˜๋Š” ํŠœํ”Œ ๋ฆฌํ„ฐ๋Ÿด(tuple literal) ํ‘œํ˜„์„ ์‚ฌ์šฉํ•˜์—ฌ ์ˆœ์„œ๋Œ€๋กœ ๋ฆฌํ„ฐ๋Ÿด ๊ฐ’ ํ˜น์€ ๋ณ€์ˆ˜๋“ค์„ ๋‚˜์—ดํ•˜๋ฉด ๋œ๋‹ค. (int count, int sum, double average) Calculate(List data) // ํŠœํ”Œ ๋ฆฌํ„ด ํƒ€์ž…(tuple re..
[C# 7.0] ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ (1) - ํŒจํ„ด ๋งค์นญ
ยท
๐Ÿ“ Language/โœ C#
C# 7.0์˜ ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ ํŒจํ„ด ๋งค์นญ ํŠœํ”Œ (Tuple) ๋กœ์ปฌ ํ•จ์ˆ˜ (Local Function) out ํŒŒ๋ผ๋ฏธํ„ฐ ์ž๋ฆฟ์ˆ˜ ๋ถ„๋ฆฌ์ž์™€ ์ด์ง„ ๋ฆฌํ„ฐ๋Ÿด Deconstructor ref local๊ณผ ref return async ์ปค์Šคํ…€ ๋ฆฌํ„ด ํƒ€์ž… ํ–ฅ์ƒ๋œ Expression-bodied ํ‘œํ˜„ throw expression https://www.csharpstudy.com/Latest/CS7-new-features.aspx C# 7.0 ์ƒˆ๊ธฐ๋Šฅ - C# ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๋ฐฐ์šฐ๊ธฐ (Learn C# Programming) ๋ณธ ์›น์‚ฌ์ดํŠธ๋Š” ๊ด‘๊ณ ๋ฅผ ํฌํ•จํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๊ด‘๊ณ  ํด๋ฆญ์—์„œ ๋ฐœ์ƒํ•˜๋Š” ์ˆ˜์ต๊ธˆ์€ ๋ชจ๋‘ ์›น์‚ฌ์ดํŠธ ์„œ๋ฒ„์˜ ์œ ์ง€ ๋ฐ ๊ด€๋ฆฌ, ๊ทธ๋ฆฌ๊ณ  ๊ธฐ์ˆ  ์ฝ˜ํ…์ธ  ํ–ฅ์ƒ์„ ์œ„ํ•ด ์“ฐ์—ฌ์ง‘๋‹ˆ๋‹ค. www.csharpstudy.com 1. ํŒจํ„ด(Patte..
[Unity] ๋ชจ๋ฐ”์ผ ๊ฒŒ์ž„ ์„ฑ๋Šฅ ์ตœ์ ํ™” 2ํŽธ
ยท
๐Ÿ“ Game/โœ Unity
๋ชจ๋ฐ”์ผ ๊ฒŒ์ž„ ์„ฑ๋Šฅ ์ตœ์ ํ™” 2ํŽธ 1. ์Œ์•… ํŒŒ์ผ wav ์›๋ณธ ์‚ฌ์šฉ ์–ด์ฐจํ”ผ ์œ ๋‹ˆํ‹ฐ์—์„œ ๋‹ค์‹œ ์••์ถ•์„ ํ•ด์ฃผ๊ธฐ ๋•Œ๋ฌธ์— mp3๋ฅผ ์ผ์„ ๋•Œ์˜ ์ด๋“์€ ํ”„๋กœ์ ํŠธ์˜ ์šฉ๋Ÿ‰์ด ์ค„์–ด๋“ ๋‹ค๋Š” ๊ฒƒ ๋ฐ–์— ์—†๋‹ค. ๊ทธ๋ ‡๋‹ค๊ณ  ์ด๋ฏธ ์••์ถ•๋œ mp3๋ฅผ wav๋กœ ๋ฐ”๊ฟ€ ํ•„์š”๋Š” ์—†๋‹ค. 2. ํ…์Šค์ณ, 3D Mesh์˜ Read/Write Enabled ์ฒดํฌ๋ฐ•์Šค ๋น„ํ™œ์„ฑํ™” CPU์—์„œ GPU๋กœ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ์˜ฎ๊ธฐ๊ณ  CPU์—์„œ๋Š” ๋‚ด๋ฆฐ๋‹ค. ํ™œ์„ฑํ™”ํ•œ ๊ฒฝ์šฐ์—๋Š” CPU์—์„œ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ๋‚ด๋ฆฌ์ง€ ์•Š์•„ ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ์ค‘๋ณต๋œ๋‹ค. ํ…์Šค์ณ๋ฅผ ๋™์ ์œผ๋กœ ์กฐ์ž‘ํ•œ๋‹ค๋ฉด ๋‹น์—ฐํžˆ ์ผœ์•ผ ํ•˜์ง€๋งŒ, ์•„๋‹ˆ๋ผ๋ฉด ๋น„ํ™œ์„ฑํ™”ํ•˜๋Š” ๊ฒƒ์ด ์ข‹๋‹ค. 3. ํ™”๋ฉด ํ•ด์ƒ๋„ ์กฐ์ ˆ Screen.SetResolution(width, height, false); 4. Renderer.material ์ ‘๊ทผ ์ฃผ์˜ Renderer.materia..