我在.NET 4框架中關注tutorial on MVC。本教程創建這樣的功能....NET 4函數:函數參數問題
using System.Web;
using System.Web.Mvc;
namespace vohministries.Helpers
{
public static class HtmlHelpers
{
public static string Truncate(this HtmlHelper helper, string input, int length)
{
if (input.Length <= length)
{
return input;
}
else
{
return input.Substring(0, length) + "...";
}
}
}
}
我不知道this HtmlHelper helper
手段或代表在功能參數。這是.NET 4中的新東西嗎?我認爲它可能會擴展HtmlHelper類,但我不知道...有人可以解釋語法嗎?
這主要是爆炸式的,但他們是一個3.5的功能;) – 2010-08-07 04:48:38
哎呀!謝謝。可以發誓我在2.0中使用過它們! – 2010-08-07 04:50:51