How to get the name of the method that caused the exception

后端 未结 3 1065
梦毁少年i
梦毁少年i 2020-12-06 04:47

My code looks as below.

try
{
    _productRepo.GetAllProductCategories();
}
catch (Exception ex)
{
    //Do Something
}

I need a way to sho

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 05:25

    Look at the stacktrace.

    It's a property on the exception.

提交回复
热议问题