I have old code that I just decompile (source was lost but we own it).
I'm now trying to recompile it but have these erros:
Error 1 'System.Data.SqlTypes.SqlBoolean.operator true(System.Data.SqlTy开发者_如何学Gopes.SqlBoolean)': cannot explicitly call operator or accessor C:\NCESTableGenerator\NCESTableGenerator\db\OutputTableDAO.cs 89 32 NCESTableGenerator
on the following piece of code:
if (SqlBoolean.op_True(reader.GetSqlInt32(0) == 1))
and
Error 3 Cannot convert type 'bool' to 'sbyte' C:\NCESTableGenerator\NCESTableGenerator\Formatter.cs 172 30 NCESTableGenerator
on the following piece of code:
public static string GetEstimateFloatStr(double data, int sn, int num, ref bool roundedZero, ref bool lowN)
{
if (sn <= 30)
{
sbyte num1 = (sbyte) lowN;
lowN = true;
return "‡";
Any ideas?
In the first line I think it's safe to rewrite it as
if (reader.GetSqlInt32(0) == 1)
and the 2nd one the troublesome line (looks like it can be removed because of the return) but if you cant remove it change it to
Int16 num1 = (Int16)lowN;
or
char num1 = (char)lowN;
Since Sbyte is not CLS-Compliant as listed by MSDN.
精彩评论