这是主要类:
public class ReportsParameter
{
public ReportsParameter(string p, decimal? nullable);
public ReportsParameter(string ParameterName, string Value);
public string parameterName { get; set; }
public string value { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
在我使用的另一个课程中:
reportsParameters1.Add(new ReportsParameter("Title", txtTitle.Text));
reportsParameters.Add(new ReportsParameter("IsCurrency", null));
reportsParameters.Add(new ReportsParameter("IsInactive", null));
Run Code Online (Sandbox Code Playgroud)
当我构建项目时,我收到以下错误:
以下方法或属性之间的调用不明确:'General.ReportsParameter.ReportsParameter(string,string)'和'General.ReportsParameter.ReportsParameter(string,decimal?)'
包含IsCurrency和的两行发生错误IsInactive.
我可以用DBNULL.Value.Tostring()吗?或者与dbnull不同?
在我的 C# 解决方案中,我有:
private void DecrementProduct()
{
decimal? difference = this.Difference;
this.Difference = new decimal?((difference.HasValue ? difference.GetValueOrDefault() : new decimal(0))--);
}
Run Code Online (Sandbox Code Playgroud)
Visual Studio 返回错误:错误 107:递增或递减运算符的操作数必须是变量、属性或索引器。
问题在哪里?