Softminer.Net
Softminer.net
Monday, August 2, 2010
Extension Method MVC
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
)
%>
1 comment:
Garage Door Installation Tennessee
September 26, 2022 at 1:12 AM
This was lovely, thanks for sharing
Reply
Delete
Replies
Reply
Add comment
Load more...
‹
›
Home
View web version
This was lovely, thanks for sharing
ReplyDelete