BryanWilhite / SonghayCore

core reusable, opinionated concerns for *all* 🧐 of my C# projects
http://songhayblog.azurewebsites.net/
MIT License
1 stars 0 forks source link

add `ProgramUtility.GetConsoleIndentation` 🔨 ✨ #167

Closed BryanWilhite closed 3 months ago

BryanWilhite commented 3 months ago
    public static string GetConsoleIndentation(int numberOfSpaces, int indentationLevel)
    {
        if (indentationLevel == 0) return string.Empty;

        string spaces = Enumerable.Repeat(" ", numberOfSpaces).Aggregate((a,i) => $"{a}{i}");

        return Enumerable.Repeat(spaces, indentationLevel).Aggregate((a,i) => $"{a}{i}");
    }