0
如何產量回報進行重構,在.NET 4.0中.NET 4.0的重構對收益回報
public static void DoIt()
{
foreach (int n in Power(2,4))
{
Console.Write(n);
}
}
public static IEnumerable CalcPower(int base, int exponent)
{
int res = 1;
for (int c = 1; c <= high; counter++)
{
res = res * base;
yield return result;
}
}
你是什麼意思?你的代碼有什麼問題?它是否編譯?它是否給出了正確的結果?你想刪除'yield return'並用其他東西替換它嗎? –
我會將'public static IEnumerable Power'更改爲'Public static IEnumerable Power' –
Rawling
爲什麼你要使用Tasks? – Stilgar