c#内部文本总是为零,尽管它有值

Mar*_*oli 0 c# asp.net

这是我的代码

 spTAC.InnerText = ((Tabn / TinBCalls) * 100) + "%";
Run Code Online (Sandbox Code Playgroud)

我发现了那个代码而且Tabn是204

TinBCalls是1162年

spTAC保持值为0%

告诉我为什么?我要放松对这件事的看法.

(该行之后没有执行代码).

<td class="informationTableValue" runat="server" id="spTAC">

                        </td>
Run Code Online (Sandbox Code Playgroud)

Fre*_*dou 7

你需要确保你把一个加倍

  spTAC.InnerText = ((Tabn / (double)TinBCalls) * 100) + "%";
Run Code Online (Sandbox Code Playgroud)

来自MSDN 7.7.2分部操作员,Visual Studio .NET 2003(相当古老,我似乎无法找到最近的链接但规则自2003年以来没有变化)

Integer division:
    int operator /(int x, int y);
    uint operator /(uint x, uint y);
    long operator /(long x, long y);
    ulong operator /(ulong x, ulong y);
Run Code Online (Sandbox Code Playgroud)

该部门将结果舍入为零......