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 Convert Boolean to Integer in C#In this tutorial, learn the different methods of converting boolean to integer data type in C# with examples. Use the Convert.ToInt32 keyword. Binary Search Tree in .Net 4.0In this tutorial, understand the implementation of binary search tree in .net 4.0. Use the Sorted Set<T> class. How to Create a Generic Function in C#We can use the type T to declare a generic data type in C#. It can be either used as a function return type or the data type of function parameters. HashSet vs List in C#In C#, a hash set is an unordered collection of unique objects while a list is a collection of objects that can be accessed by an index. C# new vs overrideThe override keyword is used to show the child implementation of a virtual function to its parent object whereas the new keyword is used to hide the child implementation from its parent class object. How to Add a Row in DataGridView Using C#This article explains adding a row to DataGridView in C#. How to Read and Parse an XML File in C#This how-to article shows different methods to read and parse an XML file in C#. It introduces methods like XmlReader.Read(), XmlReader.IsStartElement() and ReadString() How to Efficiently Remove All Whitespaces From a String in C#This how-to article shows different methods to efficiently remove all whitespaces from a string in C#. It introduces methods like Regex.Replace(), String.Replace() and Where method How to Convert a Char to an Int in C#This how-to article shows different methods to convert a char to an int in C#. It introduces methods like GetNumericValue(), Difference with 0, Int32.Parse() and GetDecimalDigitValue() How to Convert Byte Array to String in C#This how-to article shows different methods to convert a byte array to a string in C#. It introduces methods like Encoding.GetString() and MemoryStream How to Make a Textbox That Only Accepts Numbers in C#This how-to article shows different methods to make a textbox that only accepts numbers in C#. It introduces methods like Regex.IsMatch(), NumericUpDown() and KeyPressEventArgs class How to Round a Decimal Value to 2 Decimal Places C#This how-to article shows different methods to round a decimal value to 2 decimal places in C#. It introduces methods like decimal.Round() and Math.Round() methods How to Convert String to Datetime in C#This C# string to datetime how-to article shows different methods to convert a string to datetime in C#. It introduces methods like Convert.ToDateTime() method, DateTime.Parse() method and DateTime.ParseExact() method How to Sort a List by a Property in the Object in C#This article introduces how to sort a list by a property in the object in C#. It includes OrderBy method and delegate. How to Pass a Method as a Parameter in C# FunctionThis article introduces various ways of how to pass a method as a parameter in C#. How to Convert an IEnumerable to a List in C#This article introduces various methods and scenarios for converting an IEnumerable to a List in C#. How to Convert a String to Float in C#This article introduces how to convert a string to float in C#. It includes the Parse() method and ToDouble() method. How to Convert a String to Boolean in C#This article introduces how to convert a string to boolean in C#. It includes ToBoolean() method and TryParse() method. How to Sort an Array in Descending Order in C#This article introduces how to sort an array in descending order in C#. It includes Array.Sort() method, Array.Reverse() method and OrderByDescending() method. How to Force Garbage Collection in C#We will delve into different methods to trigger garbage collection in C#, providing detailed examples and explanations for each approach. C# Private SetIn this article, we will look into the intricacies of C# private set, exploring its syntax, use cases, advantages, and potential pitfalls. Modulo Operator in C#This tutorial introduces the modulo operator in C# to get the division remainder. How to Create SQL Database in C#In this tutorial, you will learn how to create an SQL database, as well as how to store and retrieve data from tables inside that database. Interface vs Abstract Classes in C#This article teaches us the difference between interface and abstract classes.