C#4 enum ๊ฐ์ ๊ตฌํ๊ธฐ int length = System.Enum.GetValues(typeof(sfxType)).Length; System.Enum.GetValues( type ).Length; -> typeof( ~ )๋ฅผ ์ฌ์ฉํ์ฌ type์ผ๋ก -> GetValues ๋์ GetNames๋ฅผ ์จ๋ ๋๊ฐ๋ค. 2022. 12. 12. CS1612 ์ค๋ฅ : 'expression'์ ๋ณ์๊ฐ ์๋๋ฏ๋ก ํด๋น ๋ฐํ ๊ฐ์ ์์ ํ ์ ์์ต๋๋ค. ๋ฌธ์ ์ ์ํฉ : Bounds์ ๋น์ทํ ํ์์ผ๋ก Min, Max Vector2๋ฅผ ๋ ๊ฐ ๊ฐ๋ ๊ตฌ์กฐ์ฒด๋ฅผ ๋ง๋ค๊ณ ์ถ์ด์ struct ํ์ ์ MovableArea๋ฅผ ์ ์ธ, min ๋ณ์์ ๊ฐ์ ๋ฃ์ผ๋ ค ํ์ ์๋ฌ ๋ฐ์ public struct MoveableArea { public Vector2 min { get; set; } public Vector2 max { get; set; } } public class MovingArea : Singleton { MoveableArea MoveableArea; private void Start() { MoveableArea.min.x = -GameManager.Instance.ScreenRectInWorldSpace.x; } } ์์ธ : get ํ๋กํผํฐ๋ก ์ป์ด์จ min์ .. 2022. 12. 1. C# ์ต์์๋ฌธ: Main ์์ด ๋ฐ๋ก ์คํํ๊ธฐ ์ต์์๋ฌธ C# 9.0๋ถํฐ ์ง์ํ๋ ์ต์์๋ฌธ์ Main์ด๋ , using์ด๋ ๋ค ํ์ ์์ด ์ฝ๋๋ง ๊ธฐ์ ํ๋ฉด ๋ฐ๋ก ์คํ๋๋๋ก ๋ง๋ค์ด์ ธ ์๋ค. ๊ธฐ์กด๋๋ก๋ผ๋ฉด Hello World!๋ฅผ ์ถ๋ ฅํ๊ธฐ ์ํด์ ์๋์ ๊ฐ์ ๋ด์ฉ๋ค์ด ํฌํจ๋์ด์ผ ํ์ง๋ง... using System; namespace ConsoleApp1 { internal class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); } } } ์ต์์๋ฌธ์ ์ฌ์ฉํ๋ค๋ฉด ์๋์ ๊ฐ์ด ํ์ผ์ ํ ์ค๋ง ๊ธฐ์ ํ๋ฉด ๊ฐ์ ๋์์ด ๊ตฌํ๋๋ค. Console.WriteLine("Hello World!"); Main, args ์ฌ์ฉ์๊ฐ Main์ ์ถ๊ฐํด๋ ์์ ์ Main์ด ์๋ ๋ค๋ฅธ ์ง์ ์ ์ผ.. 2022. 11. 22. for๋ฌธ์์ List ์์๋ฅผ ์ญ์ ํ ๋ ์ ์ํ ์ List๋ ์ค๊ฐ์ ์๋ ์์๊ฐ ๋น ์ง๋ฉด ๊ทธ ์ดํ์ ์ธ๋ฑ์ค๋ฅผ ์์ผ๋ก ๋น๊ฒจ์ฃผ๊ธฐ ๋๋ฌธ์ ์ญ์ ์ ์ ์ํด์ผ ํจ ๋ฐฉ๋ฒ 1. ์ธ๋ฑ์ค ๊ฑฐ๊พธ๋ก ์ ๊ทผํ๊ธฐ for(i = 0; i -1; i--) { if(list[i] == ~~) list.RemoveAt(list[i]); } 2022. 11. 17. ์ด์ 1 ๋ค์