Tuesday, March 24, 2009

list find predicate delegate .net

Here is an example how to use delegate to use for custom searching thru generic list

List<employee> ListEmployes = new List<employee>();
string strFirstName = "Mark";

Employee employeeResult = objListSomeClass.Find(delegate(Employee employee )
{
return employee.Name==strFirstName ;
}

capitalize first letter word C#

Just a quickie not this can be really helpful for displaying string properly.

string strSomething="PLEASE CAPITALIZE THE FIRST LETTER OF EVERY WORD"
or
string strSomething="please capitalize the first letter of every word"

System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(strSomething.ToLower())

the result
"Please Capitalize The First Letter Of Every Word"

DotNetNuke Custom Module Development