How to Create Razor Function in Asp.Net MVC View?

See given below image:

index


Razor function is exactly similar to C#/vb.net methods/Function. These features came asp.net MVC 3.0 onward. Here we can write the frequently used functionality inside the function.

Here I will show how to use in Razor function in view.

We have to give function syntax like this:
  1. @functions  
  2. {  
  3.    // Here will be C# method  
  4. }  
For calling the function Just give @MethodName

Note: I hope you are aware of creating view in asp.net MVC.

function