📜  c# 重复字符串 x 次 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:01.311000             🧑  作者: Mango

代码示例2
// Normally in a namespace, of course.
public class LoopUtilities
{
    public static void Repeat(int count, Action action)
    {
        for (int i = 0; i < count; i++)
        {
            action();
        }
    }
}

using static LoopUtilities;

// Class declaration etc, then:
Repeat(5, () => Console.WriteLine("Hello."));