متدهای الحاقی - Extension Methods
نویسنده: علیرضا اسمرام
تاریخ: ۱۳۹۲/۰۱/۰۵ ۰:۳۵
آدرس: www.dntips.ir
| مطالب | ۳۶۹۴ |
| نویسندگان | ۲۷۶ |
| گروههای مطالب | ۱۰۲۴ |
| نقشههای راه | ۱۱۹ |
| دورهها | ۱۴ |
| اشتراکها | ۱۷۹۱۴ |
string htmlStr = "<h1>.Net Tips</h1>"; htmlStr.ClearHtmlTags();
image1.Resize(50, 80);
dropDownList1.Bind((List<Category>)categories, "Name", "Id");
public static class StringExtensions
{
/// <summary>
/// Count all words in a given string
/// </summary>
/// <param name="input">string to begin with</param>
/// <returns>int</returns>
public static int WordCount(this string input)
{
var count = 0;
try
{
// Exclude whitespaces, Tabs and line breaks
var re = new Regex(@"[^\s]+");
var matches = re.Matches(input);
count = matches.Count;
}
catch (Exception)
{
return -1;
}
return count;
}
}var s = "i Love Dot Net Tips."; var wordCount = s.WordCount();
Microsoft Visual Studio TF31002: Unable to connect to this Team Foundation Server: http://dntextensions.codeplex.com/. Team Foundation Server Url: http://dntextensions.codeplex.com/. Possible reasons for failure include: - The name, port number, or protocol for the Team Foundation Server is incorrect. - The Team Foundation Server is offline. - The password has expired or is incorrect. Technical information (for administrator): The remote server returned an error: (404) Not Found.
سلام
مشابه Class helper در دلفی است...