Can you use @section in a partial view?

2019-08-05 04:40发布

问题:

I'm trying to use the @section within a partial view so that what is included is only in one file. Will this work? This approach doesn't seem to render anything.

回答1:

No. It doesn't work. You have to use it in the base .cshtml page.