小编Ami*_*ush的帖子

csharp项目中方法之间的歧义

这是主要类:

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#

0
推荐指数
1
解决办法
211
查看次数

递减或递增十进制值

在我的 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:递增或递减运算符的操作数必须是变量、属性或索引器。

问题在哪里?

c# decimal

-1
推荐指数
1
解决办法
941
查看次数

标签 统计

c# ×2

decimal ×1