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 Popup A Message in C#Discover how to popup a message in C TextBox New Line in C#Discover how to use the TextBox.Multiline property in C How to Destroy Object in C#Learn how to destroy objects in C The Difference Between Environment.Newline and Discover the key differences between Environment.Newline and "\n" in C How to Convert Int to Float in C#Learn how to convert an int to a float in C How to Write a Multiline String Literal in C#This article explores how to write multiline string literals in C How to Get the Length of an Array in C#Discover how to get the length of an array in C How to Get File Name From the Path in C#This article provides a comprehensive guide on how to get the file name from a path in C Exponent in C#This article explores the exponent operator in C Double Question Mark in C#This article explores the double question mark operator in C How to Shuffle a List in C#Unfortunately, there is no pre-defined method available for shuffling a list in C#. So, we have to rely on self-generated code for shuffling a list in C#. How to Return Multiple Values From a Function in C#There are 3 main methods that can be used to return multiple values from a function in C#, using array as the function return-type, using a class or a structure as the function return-type, and using a Tuple<T1,T2> class as the function return-type. How to Remove a Character From a String in C#There are 4 main methods that can be used to remove a character from a string in C#, the string.Replace() function, the string.Join() and string.Split() functions, the Regex.Replace() function and the Linq method. How to Get Local IP Address in C#There are 4 main methods that can be used to get local IP address in C#, the Dns.GetHostEntry() function, the Socket.LocalEndPoint property, the Linq method and the NetworkInterface class. Difference Between Struct and Class in C#The structures are value type variables that reside in the stack while the classes are reference type variables that reside in the heap. 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 Pass a Function as a Parameter in C#There are 2 main methods that we can use to pass a function as a parameter inside another function in C#, the func<> delegate, and the Action<> delegate. How to Resize an Image in C#There are 2 main methods that can be used to resize an image in C#, the Bitmap class constructor and the graphics.DrawImage() function. How to Pause Console in C#There are 3 main methods that can be used to pause the console of visual studio in C#, the Console.ReadLine() function, the Console.ReadKey() function, and the Ctrl + F5 shortcut. How to Generate a Random Float in C#This article will discuss the methods on how to generate random float values in C#. How to Declare a Multidimensional List in C#Unfortunately, there is no built-in method to declare a multidimensional list in C#. To achieve this objective, we can use one of the following user-defined approaches. the list of lists, the list of classes, and the list of tuples. How to Declare a Global Variable in C#Unfortunately, there is no built-in method to declare a truly global variable in C#. To achieve this objective we have to rely on some user-defined approaches. How to Create an Inline Function in C#There are 3 main methods that can be used to create an inline function in C#, by using lambda expressions, by using lambda statements, and by using local functions. How to Convert Float to Int in C#There are 4 main methods that can be used to convert a float to int in C#, the explicit typecasting method, the Math.Ceiling() function, the Math.Floor() function, and the Math.Round() function.