Practical solutions

C# Howtos How-To Guides

Solve the problem. Keep building. Collection of C# how-to articles

Find the answer you need

Browse practical solutions, grouped by the task you're working on.

__COUNT__ entries on this page

How to Round a Double Value to an Integer Value in C#Use Math.Ceiling(), Math.Floor(), or Math.Round() to round a double value to an integer value in C#, choosing the rule that matches your needs. How to Remove a Character From a String in C#Learn how to remove one character or a selected set from a C# string with string.Replace(), string.Split() and string.Join(), Regex.Replace(), or LINQ. How to Make HTTP POST Web Request in C#There are 3 main methods that can be used to make an HTTP POST Web Request in C#, the WebClient class, the HttpWebRequest class, and the HttpClient class. How to Clear ListBox in C#Learn how to clear a ListBox in C How to Sort a List in Alphabetical Order in C#This article shows how to sort a list alphabetically in C#. Graph Library in C#In this article, we'll learn about what are graphs, QuickGraph library, and tools used in C#. How to Capture Desktop and Active Window Screenshot in C#This tutorial shows how to capture desktop and active window screenshot in C#. How to Include a Class Into Another Class in C#This tutorial teaches how to include a class in another class in C#. How to Clear the Console Window in C#This tutorial will explain and demonstrate the method to make the console window clear using C#. How to Delete All Files in a Directory in C#Use DirectoryInfo.GetFiles() or EnumerateFiles() to remove files in C#. DirectoryInfo.Delete(true) removes the directory it is called on and its contents; to keep a parent directory, call it individually on each child directory. How to Convert Int to Byte in C#Choose between converting an integer to one byte or serializing it as a byte array in C#. How to Use a Bitmask in C#In this article, we'll learn how to use bitmask in C#. How to Disable and Enable Buttons in C#Disable and re-enable buttons in Windows Forms, WPF, and ASP.NET with the correct state property and event-handler patterns. How to Get File Name From the Path in C#Learn how to use C# path APIs to get a file name from a path, handle platform-specific separators, and distinguish file paths from URLs. Standard Deviation in C#Calculate population standard deviation in C# with a custom method or an extension method, and handle empty or reusable sequences. How to Convert Enum to String in C#Convert an enum value to its member name with ToString(), or use DescriptionAttribute and a switch mapping for custom display labels. How to Do Percentage Calculation in C#Learn how to calculate a percentage of a value, increase a value, and decrease a value in C#. How to Reset Timer in C#Restart a one-shot System.Timers.Timer in C# with Stop and Start, and learn how AutoReset controls recurring elapsed events. How to Check Whether a File Exists in C#Learn how to check whether a file exists in C# with File.Exists and how to use the result safely. How to Convert String Array to Int Array in C#In this guide, we will learn how to convert a string array to an int array in C#. How to Exit Console Application in C#Choose between returning from Main and terminating a C# console application immediately, with clear exit-code and cleanup behavior. How to Stop a Thread in C#In this article, I'll explain how to start and stop a thread in C#. Carriage Return in C#In this article, we'll learn carriage return in a string in C#. How to Minimize Applications in the System Tray in C#This article explains how to minimize a Windows Forms application to the system tray with NotifyIcon in C#, hiding the form and restoring it from the tray icon.