函数的参数错误无效

时间:2015-11-19 13:26:38

标签: c#

功能 MouldingDetail_UpdateDetails(string mouldItem,string mouldQty,int core,int freerider,decimal plate,string plant,string systemMode)

过了之后  当我通过时,MouldingDetail_UpdateDetails(" AX5M211531",' 1',1,1,' 0.5'," CMLD1",string.Empty)以下是它显示的值"无效的参数"

2 个答案:

答案 0 :(得分:2)

'1'不是有效字符串,而是字符串。

为了正确理解,请阅读 - https://msdn.microsoft.com/en-us/library/cs7y5x0x(v=vs.90).aspx

答案 1 :(得分:2)

这是该方法的签名:

MouldingDetail_UpdateDetails(
     string,
     string,
     int,
     int,
     decimal,
     string,
     string
)

然而,你正在路过:

MouldingDetail_UpdateDetails(
     "AX5M211531" (string), // Good
     '1' (char),            // Wrong! This is supposed to be a string! use "1" instead
      1 (int),              // Good
      1 (int),              // Good
      '0.5' (invalid char), // Wrong! This shouldn't even compile. Use 0.5M without the single quotes
      "CMLD1" (string),     // Good
      string.Empty (string) // Good
);