Explicitly convert the short to a byte in c#

Jitendrasoft09
Posted by Jitendrasoft09 under C# category on | Points: 40 | Views : 888
using System;

class JkExample {

static void Main(string[] args) {

short s = 500;

byte b = (byte)s;

Console.WriteLine("Original value: {0}", s);
Console.WriteLine("Explicitly converted value: {0}", b);

Console.ReadLine();
}
}

Comments or Responses

Login to post response