(* over .NET Framework 3.5)
ref url. http://weblogs.asp.net/scottgu/archive/2007/03/13/new-orcas-language-feature-extension-methods.aspx
this 키워드를 통해 기존에 존재하는 Object의 Static 메소드를 추가한 것 처럼 만들 수 있다.
public static class ScottGuExtensions
{
public static bool IsValidEmailAddress(this string s)
{
Regex regex = new Regex(@"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$");
return regex.IsMatch(s);
}
}
스캇 구슬희 형님의 VS에서 인텔리센스 되는 모습..

'.NET > C#' 카테고리의 다른 글
| C# - Diroctory Copy (Recursive method) (0) | 2011/03/29 |
|---|---|
| Q&A - Send a None exist email with SmtpClient(C#) (0) | 2011/03/27 |
| C# 'this' keyword - Extension Method (0) | 2011/02/25 |
| Last.fm API and Facebook API for .NET (0) | 2010/11/01 |
| Windows Service Debugging (0) | 2009/10/21 |
| Unicode 한글 코드 표 (0) | 2009/09/27 |
이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^

Prev



