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 Int to Enum in C#Learn how to convert an integer to a C# enum with a cast or parsing, and check whether the result is a declared member. How to Exit a Foreach Loop in C#Stop a C# foreach loop with break, or leave its containing method with return. How to Convert Float to Int in C#Convert a C# float to int with a direct cast, Math.Ceiling(), Math.Floor(), or Math.Round(), depending on the rounding behavior you need. How to Read Integer From Console in C#This article explores various methods for reading integer values from the console in C#, providing insights into when and how to use each approach. How to Export Data to an Excel File Using C#Compare ways to prepare C# object collections, arrays, DataTables, and JSON records for an Excel workbook. Convert decimal to int in C#Choose truncation, nearest rounding, or directed rounding when converting a decimal to an int in C#, and handle values outside the Int32 range. How to Read Barcode in C#This article briefly discusses reading Barcode from an image using C#. typedef Equivalent in C#Learn the C# equivalent of typedef with using aliases, including C# 12 tuple aliases and ordinary aliases for generic types. How to Initialize a Dictionary in C#Learn how to initialize a dictionary in C Partial Class in C#Discover the concept of partial classes in C How to Reverse a String in C#Learn how to reverse a string in C How to Call Constructor of Base Class From the Constructor of Child Class in C#Learn how to effectively call the constructor of a base class from the constructor of a child class in C How to Sort Dictionary by Value in C#Learn how to sort a dictionary by value in C How to Get Screen Size in C#Learn how to get screen size in C How to Check if a String Is Null or Empty in C#Learn how to check if a string is null or empty in C C# Equals() vs ==Explore the differences between C C# Error: Inaccessible Due to Its Protection LevelIn this guide, learn about the C String Tokenizer in C#Learn how to effectively tokenize strings in C How to Remove Illegal Characters in Filename in C#Learn how to remove illegal characters from filenames in C How to Remove HTML Tags From a String in C#In this article, we explore effective methods to remove HTML tags from a string in C How to Copy Text to Clipboard in C#Learn how to copy text to the clipboard in C How to Find the Greatest Common Divisor Using C#This tutorial explores how to find the greatest common divisor (GCD) using C How to Get Mouse Position Using C#Learn how to get the mouse position in a C How to Add Right Click Menu to an Item in C#Learn how to add a right-click menu to an item in a C