📅  最后修改于: 2022-03-11 14:48:52.335000             🧑  作者: Mango
// AppSettingsController.cs
[Route("appsettings")]
public class AppSettingsController : Controller
{
...
protected readonly IOptions _roundTheCodeSyncOptions;
public AppSettingsController(..., IOptions roundTheCodeSyncOptions)
{
...
_roundTheCodeSyncOptions = roundTheCodeSyncOptions;
}
...
[Route("second-way")]
public IActionResult SecondWay()
{
return Content(_roundTheCodeSyncOptions.Value.Title, "text/plain");
}
}