Byte.ToString() Method in C#


The Byte.ToString() method in C# converts the value of the current Byte object to its equivalent string representation.

Syntax

Following is the syntax −

public override string ToString ();

Example

Let us now see an example to implement the Byte.ToString() method −

using System;
public class Demo {
   public static void Main(){
      byte val1, val2;
      val1 = Byte.MinValue;
      val2 = 15;
      Console.WriteLine("Value1 (Byte) = "+val1.ToString());
      Console.WriteLine("Value2 (Byte) = "+val2.ToString());
   }
}

Output

This will produce the following output −

Value1 (Byte) = 0
Value2 (Byte) = 15

Updated on: 08-Nov-2019

30 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements