From f70b6d42ddac55660817f0357849bebcd016623d Mon Sep 17 00:00:00 2001 From: Dyego Maas Date: Wed, 12 Jan 2022 20:08:53 -0300 Subject: [PATCH] Refactoring. --- 55_Life/csharp/Program.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/55_Life/csharp/Program.cs b/55_Life/csharp/Program.cs index 32514c75..8da15360 100644 --- a/55_Life/csharp/Program.cs +++ b/55_Life/csharp/Program.cs @@ -251,8 +251,12 @@ public class Pattern { Height = patternLines.Count; Width = patternLines.Max(x => x.Length); - - Content = patternLines + Content = NormalizeWidth(patternLines); + } + + private string[] NormalizeWidth(IReadOnlyCollection patternLines) + { + return patternLines .Select(x => x.PadRight(Width, ' ')) .ToArray(); }