From 7cf7b12281bd6ea0722a900a29341332d0ffa35c Mon Sep 17 00:00:00 2001 From: Aptivi Date: Thu, 3 Oct 2024 15:41:23 +0300 Subject: [PATCH] imp - prf - Don't run through all types --- This brings little to no performance improvements, but reduces the number of calls to Get*() functions in both the vCard and the vCalendar instances. --- Type: imp Breaking: False Doc Required: False Backport Required: False Part: 1/1 --- VisualCard.Calendar/Parts/Calendar.cs | 9 +++------ VisualCard/Parts/Card.cs | 6 ++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/VisualCard.Calendar/Parts/Calendar.cs b/VisualCard.Calendar/Parts/Calendar.cs index 89b3d46..61e414e 100644 --- a/VisualCard.Calendar/Parts/Calendar.cs +++ b/VisualCard.Calendar/Parts/Calendar.cs @@ -282,8 +282,7 @@ internal string SaveToString(Version version, Dictionary(partsArrayEnum, version, partsArray); diff --git a/VisualCard/Parts/Card.cs b/VisualCard/Parts/Card.cs index c8c6305..29d6085 100644 --- a/VisualCard/Parts/Card.cs +++ b/VisualCard/Parts/Card.cs @@ -196,8 +196,7 @@ public string SaveToString() cardBuilder.AppendLine($"{VcardConstants._versionSpecifier}:{version}"); // Then, enumerate all the strings - StringsEnum[] stringEnums = (StringsEnum[])Enum.GetValues(typeof(StringsEnum)); - foreach (StringsEnum stringEnum in stringEnums) + foreach (StringsEnum stringEnum in strings.Keys) { // Get the string values var array = GetString(stringEnum); @@ -231,8 +230,7 @@ public string SaveToString() } // Then, enumerate all the arrays - PartsArrayEnum[] partsArrayEnums = (PartsArrayEnum[])Enum.GetValues(typeof(PartsArrayEnum)); - foreach (PartsArrayEnum partsArrayEnum in partsArrayEnums) + foreach (PartsArrayEnum partsArrayEnum in partsArray.Keys) { // Get the array value var array = GetPartsArray(partsArrayEnum);