我希望在我的API中使用此方法,但这是无效的。
答案 0 :(得分:0)
如果您要向控制器继承ApiController
类,则可以使用this
运算符
例如,
using System;
using System.Web.Http;
...
public class SampleController : ApiController
{
public IActionResult GetSample()
{
//Your code goes here
this.Validate(); //This is the way to call Validate method
}
}