C#版本__FUNCTION__宏版本

2023-09-04 01:12:07 作者:爱情在时光里阵亡

有没有人有一个C#版本的C ++ __FUNCTION__宏好的解决办法?编译器似乎并不喜欢它。

Does anyone has a good solution for a C# version of the C++ __FUNCTION__ macro? The compiler does not seem to like it.

推荐答案

尝试而不是使用此。

System.Reflection.MethodBase.GetCurrentMethod().Name

C#不具有 __ LINE __ __功能__ 宏象C ++,但也有等效

C# doesn't have __LINE__ or __FUNCTION__ macros like C++ but there are equivalents