C#
C#

help

Root Question Message

fenixblades
fenixblades12/10/2022
✅ Any modern approach to getting the calling class typename aside from using the stack frame?

10 years ago I used to use the stack frame to go backwards and get what class is calling my current method. I know there's attributes as well, but they are more physical file based. Is there a modern approach in current .NET to getting this information at runtime? Such as for a logger method that's trying to find out what called it?
Sossenbinder
Sossenbinder12/10/2022
These are what you are looking for I think
Sossenbinder
Sossenbinder12/10/2022
CallerMemberName mostly
ContactFrequently Asked QuestionsJoin The DiscordBugs & Feature RequestsTerms & Privacy