Professional Documents
Culture Documents
Threading
Threading
- thread is an independent execution path, able
to run simultaneously with other threads
- saves wastage of CPU cycle and increase
efficiency of an application
- parallel execution of code
- the “main” thread (Thread.CurrentThread)
- System.Threading
Threading
- Thread Life Cycle
http://msdn.microsoft.com/en-us/library/az24scfc.aspx
Regular Expressions
static void Main(string[] args)
{
string str = "A Thousand Splendid Suns";
MatchCollection mc = Regex.Matches(str, @"\bS\S*");
Console.WriteLine("Matching words that start with 'S': ");
foreach (Match m in mc)
{
Console.WriteLine(m);
}
Console.ReadKey();
}
Regular Expressions
static void Main(string[] args){
string input = "Hello World ";
string pattern = "\\s+";
string replacement = " ";
Regex rgx = new Regex(pattern);
string result = rgx.Replace(input, replacement);