Char To Ascii - CSharp System

CSharp examples for System:Char

Description

Char To Ascii

Demo Code


using System.Web;
using System.Text;
using System.Security.Cryptography;
using System.Linq;
using System.Collections.Generic;
using System;/*from   w  ww.ja  v a  2s  .c  o m*/

public class Main{
        public static int CharToAscii(char c)
        {
            byte[] array = Encoding.ASCII.GetBytes(new char[] { c }, 0, 1);
            int asciicode = (short)(array[0]);
            return asciicode;
        }
}

Related Tutorials