Tag: convert

Converting an Enum to Integer in C#

If you need to convert an enum to its numeric equivalent , you can simply cast the values to integer . Below is a sample code snippet that demonstrates how to do it. Converting an Enum to Integer in C#

How to convert Array to List in Java ?

This article will explain how to convert a simple array to list in Java . How to convert Array to List in Java ? The Java’s array class provides necessary methods to convert the array to the List using the asList method. Below is a sample code snippet demonstrating the usage of the Arrays.asList method to convert array to List.

How to convert Ascii value to character in C# ?

In C# , you can convert the Ascii value to its corresponding character by assigning the value to a character . How to convert Ascii value to character in C# ? Below is a sample sourcecode to demo how to convert Ascii value to character in C#

Top Tools to Convert HTML to PDF in .NET

There are times when you may want to generate PDF from the simple HTML data . There are plenty of tools available that lets the developers to easily convert HTML to PDF in .NET . Below are some of the well known tools to perform the task. Top Tools to Convert HTML to PDF in .NET wkhtmltopdf A simple shell utility tool that lets the…

How to Convert a List to ObservableCollection in C#?

This simple blog post will explain how to convert a List of Object to ObservableCollection of Object in C# and Windows Phone 8. There are times when you want to convert a List of Object to ObservableCollection specially when binding an ObservableCollection to the LongListSelector etc. The reasons for this can be several. How to Convert a List to ObservableCollection in C#? To Convert a…

How to Convert a Byte Array to Integer in C# ?

To Convert a Byte array back to the integer , the developers can use the BitConverter.ToInt32 method which accepts byte array as input and returns the number . Below is a sample code snippet that demonstrates how to convert a byte array to integer in C#. How to Convert a Byte Array to Integer in C# ?

How to convert a string to integer in C# ?

You can convert a string to integer in C# using the following functions 1. Int32.Parse / int.Parse 2. Convert.ToInt32 3. Int.TryParse() How to convert a string to integer in C# ? Below is a sample sourcecode demonstrating the usage of the above functions The advantage of using the int.tryparse is that when the string (str) in the above example is a invalid number , a…

How to Convert a Stream to Byte Array in C# 4.0 ?

One of the simplest way to convert a stream to byte array in C# 4.0 is to use the MemoryStream and perform the CopyTo operation on the source stream to the Memory Stream. How to Convert a Stream to Byte Array in C# 4.0 ? Below is a sample code snippet on how to convert a stream to byte array in C# 4.0.