Add another TaggedStringElement definition to support multiple key value pairs in XML tags

This commit is contained in:
LumaLivy 2021-11-04 00:57:42 -04:00
commit ce032d8e4d

View file

@ -26,6 +26,11 @@ namespace LBPUnion.ProjectLighthouse.Serialization
public static string TaggedStringElement(string key, object value, string tagKey, object tagValue) => $"<{key} {tagKey}=\"{tagValue}\">{value}</{key}>";
public static string TaggedStringElement(string key, object value, Dictionary<string, object> attrKeyValuePairs)
=> $"<{key} " +
Enumerable.Aggregate(attrKeyValuePairs, string.Empty, (current, kvp) => current + $"{kvp.Key}=\"{kvp.Value}\" ") +
$">{value}</{key}>";
public static string Elements
(params KeyValuePair<string, object>[] pairs)
=> pairs.Aggregate(string.Empty, (current, pair) => current + StringElement(pair));