From 8b29903444a2e75c86390b3d7a0348b7e0c0c161 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 28 Sep 2020 20:43:37 +0200 Subject: [PATCH] Replace ImageCode and TextField character ToString usage with ToCachedString for memory performace --- MLEM.Ui/Elements/TextField.cs | 2 +- MLEM/Formatting/Codes/ImageCode.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MLEM.Ui/Elements/TextField.cs b/MLEM.Ui/Elements/TextField.cs index 5c2775f..2f24612 100644 --- a/MLEM.Ui/Elements/TextField.cs +++ b/MLEM.Ui/Elements/TextField.cs @@ -270,7 +270,7 @@ namespace MLEM.Ui.Elements { if (removeMismatching) { var result = new StringBuilder(); foreach (var c in text.ToString()) { - if (this.InputRule(this, c.ToString())) + if (this.InputRule(this, c.ToCachedString())) result.Append(c); } text = result.ToString(); diff --git a/MLEM/Formatting/Codes/ImageCode.cs b/MLEM/Formatting/Codes/ImageCode.cs index 5951c17..dbbfbbc 100644 --- a/MLEM/Formatting/Codes/ImageCode.cs +++ b/MLEM/Formatting/Codes/ImageCode.cs @@ -25,7 +25,7 @@ namespace MLEM.Formatting.Codes { /// public override string GetReplacementString(GenericFont font) { - return GenericFont.OneEmSpace.ToString(); + return GenericFont.OneEmSpace.ToCachedString(); } ///