This article guides you to serialize object to XML in C#. Below is a complete example to show writing the data stored in a class object to an XML file. How to Write Object Data to an XML File in C# ( Serialize C# Object to XML File)? Serialization is the process of converting an object into XML […]
Calculate the Size of a Directory in C#
Calculate Directory Size in C#: By default, we cannot directly retrieve the total size of a directory in .NET, including subdirectories. So how to find the directory size in C# ,VB.NET or any other .NET language? We need to have a workaround method that will return the total size of a directory in bytes.Here we need to […]
Convert Int List to String List in C#
Generic collection List has methods for dealing with internal data of the collection.One of the methods of List , ConvertAll() along with lambda expression can be used for converting List to List. Convert List to List in C# var intList = new List {1, 2, 3, 4, 5}; //Using lambda expression along with ConvertAll() var […]
Check Whether Two Strings are Anagrams in C#
Words are called anagrams of if they all share the same set of letters to form the respective words. Example: Dealer –>Leader, POT–> Top –>Opt , Dear –> Read In this post, I am giving the sample code to check whether two words are anagrams Anagrams Check in C# /// <summary> /// Determine if the two strings are […]
Check if a String is Palindrome in C#?
Palindromes are strings that if read in both directions will be the same. Eg:- Malayalam, Civic In this C# coding example, we will check whether a given string is Palindrome or not using C# language. So, how can we check whether a string is a palindrome in C# or any other programming language? There are […]