How to create a function in a cshtml template?

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 page, because they’re scoped to one page. I know about HTML helpers (extension methods), but my function is just needed in one cshtml file. I don’t know how to create a function signature inside a view.
Note: I’m using Razor template engine.

6 Answers
6

Leave a Comment