為指定類型擴展方法
定義類Class
public static class Class
{
/// <summary>
/// 返回指定字符串中以
/// </summary>
/// <param name=
/// <returns>整型</returns>
public static int ArrayListLenght(this string value)
{
int len =
if (value
{
len = value
}
return len;
}
}
頁面調用
protected void Page_Load(object sender
{
string sValue =
int count = sValue
Response
}
輸出
上面只是列舉
From:http://tw.wingwit.com/Article/program/net/201311/13177.html