C# version of __FUNCTION__ macro

后端 未结 6 1809
有刺的猬
有刺的猬 2021-02-19 01:18

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

6条回答
  •  梦谈多话
    2021-02-19 01:35

    The following should work, although it will be evaluated at runtime instead of during compilation.

    System.Reflection.MethodBase.GetCurrentMethod().Name
    

提交回复
热议问题