Thursday, September 13, 2007

Simple Email validation class in .Net 3.5 - Orcas Feature

There is a class named EmailValidator in .Net 3.5 to validate email address. This class contain a static method called "IsValid" to validate email string. Sample code given below.

string email = "raja@test.com";

if
( EmailValidator.IsValid(email) ) {

}

There is another way to validate email string.

string email = "raja@test.com";

if
( email.IsValidEmailAddress() ) {

}

No comments: