mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-28 07:58:40 +00:00
Add another TaggedStringElement definition to support multiple key value pairs in XML tags
This commit is contained in:
parent
35fba33216
commit
ce032d8e4d
1 changed files with 5 additions and 0 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue