Search code examples
c#asp.net-mvcasp.net-mvc-3razor

How do I define a method in Razor?


How do I define a method in Razor?


Solution

  • Leaving alone any debates over when (if ever) it should be done, @functions is how you do it.

    @functions {
    
        // Add code here.
    
    }