C# Convert a string to ASCII bytes

前端 未结 3 820
旧时难觅i
旧时难觅i 2021-01-20 05:30

I have a string:

LogoDataStr = \"ABC0000\"

I want to convert to ASCII bytes and the result should be:

LogoDataBy[0] = 0x41;         


        
3条回答
  •  死守一世寂寞
    2021-01-20 05:39

    Just throwing:

    Encoding.ASCII.GetBytes("ABC0000").Dump();
    

    Into LinqPAD gives an output of (decimal):

    Byte[] (7 items)
    65
    66
    67
    48
    48
    48
    48

    So I'm not sure how you're getting 0x00...

提交回复
热议问题