C#控制台基础 将十六进制的字符串 转换成 十进制数

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_39561376/article/details/78157655



代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = "FF";
            Byte b= Byte.Parse(str.Substring(0, 2),
                System.Globalization.NumberStyles.HexNumber);
            Console.WriteLine(b);
            Console.ReadKey();
        }
    }
}

运行结果


猜你喜欢

转载自blog.csdn.net/qq_39561376/article/details/78157655
今日推荐