How to get ascii values of chars in c#?

Total Post:61

Points:429
C#  ASP.Net 
C#
 1443  View(s)
Ratings:
Rate this:
I am accustom to coding in java, but recently i have been making some asp webpages that use c#. in Java chars are default represented by their numeric ascii value unless you put them with a string. I have been unable to repeat this in c#. what do i need to do to get ascii values of chars in c#.


  1. Post:194

    Points:1396
    Re: How to get ascii values of chars in c#?

    try this code:

    public static IEnumerable<int> Utf32CodePoints(string s, int index)
    {
        for (int length = s.Length; index < length; index++)
        {
            yield return char.ConvertToUtf32(s, index);
            if (char.IsSurrogatePair(s, index))
                   index++;
            }
        }
    }

      Modified On Apr-05-2018 06:37:05 AM

Answer