일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- .net
- mysql
- Visual Studio
- Microsoft
- csharp
- commit
- Binding
- windows10
- Coding
- convert
- IValueConverter
- 코딩테스트
- git
- log
- coding-test
- logging
- WPF
- string
- File
- programmers
- nullable
- ListView
- dotNET
- Github
- tls
- algorithm
- windows
- C#
- Process
- chashtag
Archives
- Today
- Total
목록attribute (1)
CHashtag
[C#] CallerMemberName Attribute 사용법
C#에는 Attribute라는 유용한 친구가 있습니다. 그중 CallerMemberName을 사용하면 이 함수를 호출한 대상에 대한 이름을 인자로 받게 됩니다. 사용법은 다음과 같습니다. // Program.cs static void Main(string[] args) { SomeFunction(); // output : Main } public static void SomeFunction([CallerMemberName] string callerName = null) { Console.WriteLine(callerName); } 한가지 주의할 점은 default value를 지정해 주어야 한다는 점입니다. CallerMemberName외에도 CallerFilePath, CallerLineNumber도 ..
C#
2021. 6. 30. 16:03