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

CsharpProgrammingServer Side Programming

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.


 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);


Converted byte 255 to Int32 255 value
Updated on 23-Jun-2020 08:47:57