Posted on 5:20 AM by Softminer and filed under

usually extension method are used to add new function to a class. for example you want to add extension method to "String" class in view like Left.

public static string Left(this String param, int length)


   string result = param.Substring(param.Length – length, length);

   return result;


then you can use it in view as
<% Model.city.Left(10) %>
Responses to ... Extension Method MVC