๐ Tech
![[Unity] ํ์ฉ ๊ฐ๋ฅํ AI ์ฝ๋ฉ ์๋น์ค 1ํธ](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbgKFss%2Fbtr5NKFB3Cs%2FtqdSegve2IyrBr4efB6xl1%2Fimg.png)
[Unity] ํ์ฉ ๊ฐ๋ฅํ AI ์ฝ๋ฉ ์๋น์ค 1ํธ
ํ์ฉ ๊ฐ๋ฅํ AI ์ฝ๋ฉ ์๋น์ค 1ํธ 1. ChatGPT ChatGPT๋ฅผ ์ด์ฉํ์ฌ ์ ๋ํฐ C# ์คํฌ๋ฆฝํธ๋ฅผ ์ง๋๋ก ํ์ฉํ ์ ์๋ค. https://openai.com/blog/chatgpt?utm_source=youtube&utm_medium=social&utm_campaign=unitylive-jan_unitytips_aicoding Introducing ChatGPT We’ve trained a model called ChatGPT which interacts in a conversational way. The dialogue format makes it possible for ChatGPT to answer followup questions, admit its mistakes, challenge inc..
[C#] struct ๋์ class๋ฅผ ์จ์ผ ํ ๋
struct ๋์ class๋ฅผ ์จ์ผ ํ ๋ ๊ฐ๋จํ ๋ฐ์ดํฐ ๊ตฌ์กฐ๋ฅผ ํํํ ๋ ์ข ์ข struct๋ฅผ ์ฌ์ฉํ๊ณค ํ๋ค. ์ด๋ ํจ์ ์์์ ์ฌ์ฉ๋๋ struct๋ Value ํ์ ์ผ๋ก ์คํ์ ์์ฑ๋๊ณ , class๋ Reference ํ์ ์ผ๋ก ์ธ์คํด์ค๊ฐ ํ์ ์์ฑ๋๋ค. ์ด๋ฌํ ๊ตฌ์กฐ์ ์ธ ์ฐจ์ด๋ ๋๋ก ๋ฒ๊ทธ๋ฅผ ๋ฐ์์ํค๊ณค ํ๋ค. ์๋์ ๊ฐ์ ์์ ๊ฐ ์๋ค. struct Employee { public string Name { get; set; } public int Salary { get; set; } } class HR { public void RaiseSalary(Employee emp) { emp.Salary = emp.Salary + 1000; } } Employee emp = new Employee(); emp.Nam..
[C#] string ๊ฐ์ฒด ์ฌ์ฉ์์ ํํ ํ๋ ์ค์
string ๊ฐ์ฒด ์ฌ์ฉ์์ ํํ ํ๋ ์ค์ ํ ๋ฉ์๋ ์์ ๋ก์ปฌ ๋ณ์๋ค์ ๊ทธ ๋ฉ์๋๊ฐ ๋๋ ๋ ํด์ ํ๊ฒ ๋๋ค. Value ํ์ ์ ๋ณ์๋ ํจ์ ๋ฆฌํด๊ณผ ๋์์ ์คํ์์ ํด์ ๋๊ณ , Reference ํ์ ์ ๋ณ์๋ GC์ ์ํด ํ์์ ์๋ ํด์ ๋๋ค. ์ฌ๊ธฐ์ ํํ ํ๋ ์ค์ ์ค ํ๋๋ ๋ ํผ๋ฐ์ค ํ์ ์ ๊ฐ์ฒด๋ฅผ ๋ถํ์ํ๊ฒ ๋๋ฌด ๋ง์ด ๋ง๋๋ ๊ฒ์ด๋ค. ์๋ฅผ ๋ค์ด ์๋ ์์ ๋ string ๊ฐ์ฒด๋ฅผ n๊ฐ ์ฉ ๊ณ์ ์์ฑํ๊ณ ์๋ค. public string Get1ToN_Bad(int n) { string s = ""; for (int i = 1; i
[C# 8.0] ์๋ก์ด ๊ธฐ๋ฅ (3) - using ์ ์ธ, ๋ ๋ณํฉ ํ ๋น์, ๊ตฌ์กฐ์ฒด ์ฝ๊ธฐ ์ ์ฉ ๋ฉค๋ฒ
C# 8.0์ ์๋ก์ด ๊ธฐ๋ฅ 5. using ์ ์ธ using ์ ์ธ์ using ๋ค์ ์๋ ๋ณ์๊ฐ using์ ๋๋ฌ์ผ ๋ฒ์๋ฅผ ๋ฒ์ด๋ ๊ฒฝ์ฐ Dispose ํ๋๋ก ์ปดํ์ผ๋ฌ์๊ฒ ์ง์ํ๊ฒ ๋๋ค. Dispose๋ ๋ฉ๋ชจ๋ฆฌ ๊ด๋ฆฌ๋ฅผ ์ํด ์ฌ์ฉ๋๋ฉฐ ๋ ์ด์ ์ด ์ค๋ธ์ ํธ๋ฅผ ์ฐ์ง ์๊ณ , ๊ด๋ จ ๋ฆฌ์์ค๋ฅผ ์ ๋ฆฌํ๋ค๋ ๋ป์ด๋ค. ๋ฉ์๋๊ฐ ๋๋ ๋ Dispose๋ฅผ ์๋ ํธ์ถํ๋ค. private void GetDataCS8() { using var reader = new StreamReader("src.txt"); string data = reader.ReadToEnd(); Debug.WriteLine(data); // ์ฌ๊ธฐ์ Dispose() ํธ์ถ๋จ } 6. ๋ ๋ณํฉ ํ ๋น์(Null Coalescing Assignment) ํํ NULL..
[C# 8.0] ์๋ก์ด ๊ธฐ๋ฅ (2) - Nullable Reference Type, ์ธ๋ฑ์ฑ๊ณผ ์ฌ๋ผ์ด์ฑ
C# 8.0์ ์๋ก์ด ๊ธฐ๋ฅ 3. Nullable Reference Type ์ด์ ๋ฒ์ ์์๋ reference ํ์ ์ null์ ํ ๋นํ ์ ์์ด Null Reference Exception์ด ์์ฃผ ๋ฐ์๋๊ณค ํ๋ค. ๊ทธ๋์ C# 8.0์์๋ reference ํ์ ์ null์ ํ ๋นํ๋ฉด ์ปดํ์ผ๋ฌ๊ฐ ๊ฒฝ๊ณ ํ๋ ๊ธฐ๋ฅ์ ์ถ๊ฐ๋์๋ค. reference ํ์ ์ ๊ธฐ๋ณธ์ ์ผ๋ก null์ ๋ฃ์ ์ ์๋ Non-nullable Reference Type์ด ๋๊ณ , NULL์ ํ์ฉํ๊ธฐ ์ํด์๋ ๋ ํผ๋ฐ์ค ํ์ ๋ค์ ๋ฌผ์ํ(?)๋ฅผ ๋ถ์ฌ Nullable Reference Type์์ ํ์ํด์ผ ํ๋ค. Nullable Reference Type ๊ธฐ๋ฅ์ ๋ํดํธ๋ก Disable ๋์ด ์์ผ๋ฉฐ ์ฌ์ฉํ๊ธฐ ์ํด์๋ ํ๋ก์ ํธ ๋ ๋ฒจ์ด๋ ํ์ผ ๋ ๋ฒจ, ํน์ ์..
[C# 8.0] ์๋ก์ด ๊ธฐ๋ฅ (1) - ๋ํดํธ ์ธํฐํ์ด์ค ๋ฉค๋ฒ, ํจํด ๋งค์นญ
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#์์ ์ธํฐํ์ด์ค๋ฅผ ํ๋ฒ ๋ฐฐํฌํ ํ, ๊ทธ ์ธํฐํ์ด์ค๋ฅผ ..