我的代码在Action方法中有以下内容:
catch (Exception e)
{
log(e);
return Content(ExceptionExtensions.GetFormattedErrorMessage(e));
}
Run Code Online (Sandbox Code Playgroud)
调用的函数如下所示:
public static class ExceptionExtensions
{
public static string GetFormattedErrorMessage(this Exception e)
if (e == null)
{
throw new ArgumentNullException("e");
}
Run Code Online (Sandbox Code Playgroud)
有人可以解释为什么在参数列表的开头有"this"吗?
c# ×1