类似16进制的处理,一个小函数,怎么出错了?
public static string GetHex(double Dec)
{
string text1 = "";
char ch1 = 'A';
if ((Dec >= 10) && (Dec <= 15))
{
ch1 += ((ushort) (Dec - 10));
return (text1 + ch1);
}
return ("" + Dec);
}
问题就出在这一个:
ch1 += ((ushort) (Dec - 10));
错误提示:
C:\projects_dotnet\PageNew\Form1.cs(312): Cannot implicitly convert type 'ushort' to 'char'
这是什么意思?不太明白~还是第一次遇到ushort.各位帮忙看看.谢谢.:)