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) %>
Response to ... Extension Method MVC
Garage Door Installation Tennessee said... September 26, 2022 at 1:12 AM

This was lovely, thanks for sharing