Convert or cast integer to character in C#


This content was proof-read by Grammarly. You can Try Grammary for FREE

Below is a sample sourecode demonstrating how to convert or cast int to char in C#

Convert or cast integer to character in C#

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ConsoleApplication1

{

internal class Program

{

// Abundantcode - function to convert int to char

private static void Main(string[] args)

{

byte Input;

char Output;

Input = 65; // 65 is the Ascii code for A

Output = (char)Input;

Console.WriteLine("Result = " + Output);

Console.ReadLine();

}

}

}
Convert or cast integer to character in C#
Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

%d bloggers like this: