How do I define a method in Razor?

Rookian picture Rookian · Mar 1, 2011 · Viewed 97.5k times · Source

How do I define a method in Razor?

Answer

David Ruttka picture David Ruttka · Mar 1, 2011

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

@functions {

    // Add code here.

}