Tag: integer

How to convert an Integer to Octal string in C# ?

You can easily format an integer to an octal string in C# using the Convert.ToString method. Below is a sample sourcecode that demonstrates How to convert an Integer to Octal string in C# ? using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { static class Program { static void Main() { FormatString(); } static void FormatString() { int intVal = 9;…

Using TryParse to parse string to integer in C#

You can use the int.TryParse to parse a string in to numbers . The function returns true if it suceeds in parsing the string to integer and false if it doesn’t. using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { static class Program { static void Main() { data(); } static void data() { // // Parsing with TryParse // string…

How to find the Max and Min value from an Integer Array ?

To find the Max and Min Value from an Integer Array , one could use the functions Max() and Min() defined in the array object. using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { static class Program { static void Main() { data(); } // sourcecode to find the Max and Min value in a array of integer static void data()…

How to Initialize integer arrays in C# ?

using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { static class Program { static void Main() { data(); } // sourcecode to demo initializing the integer array static void data() { int[] arrData = new int[5] { 76, 201, 230, 400, 10 }; for (int i = 0; i < arrData.Length; i++) { MessageBox.Show(arrData[i].ToString()); } } } } Tutorials you might…