I need to create a function that is only necessary inside one cshtml file. You can think of my situation as ASP.NET page methods, which are min web services implemented in a
You can use the @helper Razor directive:
@helper WelcomeMessage(string username) { Welcome, @username. }
Welcome, @username.
Then you invoke it like this:
@WelcomeMessage("John Smith")