C# Program to convert a Byte value to an Int32 value


To convert a Byte value to an Int32 value, use the Convert.ToInt32() method.

Int32 represents a 32-bit signed integer.

Let’s say the following is our Byte value.

byte val = Byte.MaxValue;;

Now to convert it to Int32.

int intVal = Convert.ToInt32(val);

Let us see the complete example.

Example

 Live Demo

using System;
public class Demo {
   public static void Main() {
      byte val = Byte.MaxValue;;
      int intVal = Convert.ToInt32(val);
      Console.WriteLine("Converted byte {0} to Int32 {1} value ", val, intVal);
   }
}

Output

Converted byte 255 to Int32 255 value

Updated on: 23-Jun-2020

6K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements