
Left, Right and Mid String Functions for C#
Unlike Visual Basic, C# doesn’t have built-in string methods to extract parts of string from the Left, Right or a location specified through Mid. Unfortunately you have to create the

Unlike Visual Basic, C# doesn’t have built-in string methods to extract parts of string from the Left, Right or a location specified through Mid. Unfortunately you have to create the

Method Overloading means that you can have different methods having the same code, but with different parameters. Here is an example: class MyMath{ public static int Add(int number1, int number2)

Add the following function: public void DownloadFile(string urlAddress, string location) { using (webClient = new WebClient()) { webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed); webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged); Uri URL = urlAddress.StartsWith(“http://”, StringComparison.OrdinalIgnoreCase)
There is a very quick and easy to determine your CPU usage. You can use the following code. All you need to do is to add a Timer and set

In order to calculate a file’s size in C#, you can use the FileInfo object and create some logic to calculate the physical KB, MB or GB of a file.

There are numerous ways to find out whether or not there is an internet connection present. One of the quickest ways is to use the InternetGetConnectedState API. Here is how

The BitBlt function simply performs a bit-block transfer of the color data corresponding to a rectangle of pixels from a source device context into a destination device context. You can

A SynchronizationContext allows one thread to communicate with another thread. For example, to update the User Interface thread (UI Thread) from an outside thread you could do something like the

LINQ?is?very?good?and?efficient?when?it?comes?to?handling?data?coming?from?a?datasource.?This?little?example?creates?a?Table?object.?Then?creates?a?DataContext?to?interpret?the?Table?data,?and?finally?does?a?query?to?extract?the?wanted?data. ????????[Table(Name?=?”Courses”)] ????????public?class?Courses?//Create?Courses?Table ????????{ ????????????[Column(IsPrimaryKey?=?true,?DbType?=?”BIGINT?NOT?NULL?IDENTITY”,?IsDbGenerated?=?true)] ????????????public?Int32?CourseID;?//Field ????????????[Column] ????????????public?string?CourseDesc;?//Field ????????} ????????????????using?(DataContext?dcCourses?=?new?DataContext(“CONNECTION_STRING))?//Connect?to?DB ????????????????{ ????????????????????var?data?=?(from?c?in?_Courses ????????????????????????????????where?c.CourseID?==?ComboBox1.SelectedIndex ????????????????????????????????select?new?{?c.CourseDesc?} ????????????????????).FirstOrDefault();?//Select?CourseID?That?Corresponds?to?ComboBox?Selection ????????????????????TextBox1.Text?=?data.Name;?//Display ?????????????????}