Is there a way to share functions with html code between .cshtml
views in ASP.NET Core? I need it to work similar to helpers, so it can be accessible from a few views. I know that some functions can be shared if moved to a .cs
file, but I've never seen cs functions with complex html code. Function example (in project they are much more complex and multiline):
@{
async Task Test(string test)
{
<div class="test">String @test</div>
}
}
Now I'm using a partial views with functions declared inside, but I do not like how it works.