[C#] ํธ์ถ์ ์ ๋ณด ์ ํธ๋ฆฌ๋ทฐํธ
2021. 11. 4. 12:17
- CallerMemberNameAttribute : ํ์ฌ ๋ฉ์๋๋ฅผ ํธ์ถํ ๋งค์๋ ๋๋ ํ๋กํผํฐ ์ด๋ฆ
- CallerFilePathAttribute : ํ์ฌ ๋ฉ์๋๊ฐ ํธ์ถ๋ ์์ ํ์ผ ๊ฒฝ๋ก
- CallerLineNumberAttribute : ํ์ฌ ๋ฉ์๋๊ฐ ํธ์ถ๋ ์์ค ํ์ผ ๋ด์ ํ ๋ฒํธ
using System.Runtime.CompilerServices;
public static void WriteLine(string message,
[CallerFilePath] string file = "",
[CallerLineNumber] int line = 0,
[CallerMemberName] string member = "")
{
Console.WriteLine($"{file}(Line:{line}) {member}: {message}");
}
728x90
'๐ฃ์ธ์ด > C#' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[C#] DataGridView ์ฒซ ์ปฌ๋ผ ์ญ์ (0) | 2021.11.30 |
---|---|
[C#] ๋ค์ด๋ฐ ๋ฃฐ (0) | 2021.11.08 |
[C#] ๋ธ๋ฆฌ๊ฒ์ดํธ : delegate, Func, Action (0) | 2021.11.04 |
[C#] System.Array ์ฃผ์ ๋ฉ์๋์ ํ๋กํผํฐ (0) | 2021.11.03 |
[C#] ํ๋กํผํฐ : get, set (0) | 2021.11.03 |