C# get ASCII value of character

C# get ASCII value of character

In this post I will show you how to get ASCII value of given character. First I will initialize the character array and get the ascii value of each element associated within it.

C# Char To ASCII Example

using System;

namespace CharElement.ASCII.Example
{
    class Program
    {
        static void Main(string[] args)
        {

          char[] arrChar = new char[] { 'a', 'A'} ;
          
          

          Console.WriteLine("ASCII value of character a is " + (int)arrChar[0] );
          Console.WriteLine("ASCII value of character A is " + (int)arrChar[1] );
          
                  
          Console.ReadLine();
              
        } 
    } 
}

 

Output

ASCII value of character a is 97
ASCII value of character A is 65

In above example ascii value of letter a is 97 and letter A is 65.

C# ASCII to character Example

using System;

namespace CharElement.ASCII.Example
{
    class Program
    {
        static void Main(string[] args)
        {
 
          Console.WriteLine("Character value of ASCII 97 is " + (char)97 );
          Console.WriteLine("Character value of ASCII 65 is " + (char)65);
                   
          Console.ReadLine();
              
        } 
    } 
}

Output

Character value of ASCII 97 is a
Character value of ASCII 65 is A
Jquery Dropdown Selected ValueC# Get Character from StringHow to get Jquery selected optionGet Selected Value From Dropdownlist [JQuery]C# Regular Expression Get Text Between BracketsC#.net Get Yesterday.C# Get File Size[C#] Remove Last Character From StringC#.net get tomorrows dateJQuery get Value Of TextareaC# Char Array

Author

My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in ASP.net year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.
 

I'm Satalaj.