This tutorial offers an introduction to multithreading in C# and it also uses a sample project to show you how to start using threads. Context Ads More C# Resources Advertisement Okay, where to start… ah yes the beginning, Multithreading is essentially the same principal as a production line in a factory each thread is a […]
Generate Random Numbers using C#
This tutorial will take you through all you need to know about generating random numbers using C#. Awards: 5 stars: Programming tutorial/source code has a rate higher than 4.5. Content: Pseudo-Random Numbers Whether you’re planning on building a game, looking to pick a lucky winner from an array of contest participants or simply want to display […]
How to remove white (blank) space from a string
Using the Replace() method you can easily replace the white space from a string with any character you want, or totally remove it. In the following example the white space from the string is removed: This will result in Anthem containing the string StarSpangledBanner.However you can replace the spaces with any character you want, such […]
Getting a list of all the files in a directory
With very little C# code you are able to loop through all the files at a given path.
String Ends With Values in Array of Strings
This simple method checks if a string ends with either of the values in an array of characters, and returns true if it does. Useful to add appropriate suffixes to words in standard form.
Generate random password
This C# function returns a randomly generated password of the specified length. You can easily modify it to include only the characters you are interested in.
Check if HTTP connection to website is available
Sample code that uses a ConnectionAvailable() method to check whether the connection to an HTTP server went through or not. Can be used to check if a certain website is online as well as if Internet connection is available on the target machine.
Set Image Opacity Using C#
A C# function for changing the opacity on an image to the specified value. It uses the System.Drawing, System.Drawing.Imaging and System.Drawing.Drawing2D namespaces.
Play MP3 Files Using C#
This code uses the Windows Multimedia API winmm.dll library to play MP3 files. Put it into a class and call the Open() method with a parameter specifying the MP3 file that you wish to play.
Simulate Mouse Click On WebBrowser Control
Sample C# code for executing any type of mouse click on a WebBrowser control by calling a set of unmanaged functions from the user32.dll library.