From 598006d735d8abd23a18024d8883cb234a6e2858 Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 11 Nov 2019 19:21:58 +0200 Subject: [PATCH] Added helper class --- Crypto Notepad/WinFormsExtensions.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Crypto Notepad/WinFormsExtensions.cs diff --git a/Crypto Notepad/WinFormsExtensions.cs b/Crypto Notepad/WinFormsExtensions.cs new file mode 100644 index 0000000..24441c9 --- /dev/null +++ b/Crypto Notepad/WinFormsExtensions.cs @@ -0,0 +1,24 @@ +using System; +using System.Windows.Forms; + +namespace Crypto_Notepad +{ + public static class WinFormsExtensions + { + public static void AppendLine(this TextBox source, string value) + { + if (source.Text.Length == 0) + source.Text = value; + else + source.AppendText("\r\n" + value); + } + + public static void Times(this int count, Action action) + { + for (int i = 0; i < count; i++) + { + action(); + } + } + } +}