operator*不能应用于decimal和double c#

Get*_*ong 3 c# tax

我目前正在制作税务程序(研究项目),该程序读取CSV文件并生成人员和帐户余额列表,我需要从一个文本框中向下舍入2个小数位,然后将其添加到另一个文本框中.我附带的代码告诉我我不能用"*"我怎么用0.1的小数乘以?如果我这样做错了让我知道,干杯!

public partial class Form1 : Form
{
    //CSV ARRAY LISTS
    List<string> fullName = new List<string>();
    List<string> accBalance = new List<string>();

    int currentItem;
    int index;
    int counter = 0;

    decimal interestBalance = 0;
    decimal result;

    decimal interestRemainder = 0;
    double round = 0.1;


 private void interestBalanceBox_TextChanged(object sender, EventArgs e)
    {
        interestRemainder = decimal.Parse(interestBalanceBox.Text);
        interestRemainder = Math.Truncate(0.1 * interestRemainder) / 100;
        interestRemainderBox.Text = interestRemainder.ToString();

    }
Run Code Online (Sandbox Code Playgroud)

我们打算代表的程序就在这里!任何帮助将非常感激.

在此输入图像描述

小智 6

interestRemainder = Math.Truncate((decimal)0.1 * interestRemainder) / 100;
Run Code Online (Sandbox Code Playgroud)

您需要将0.1转换为与另一个操作数相同的类型

  • `0.1M`可能比`(十进制)0.1`简单 (3认同)