welsonjs/WelsonJS.Toolkit/WelsonJS.Toolkit/Serialization/KVSerializer.cs
2024-08-06 19:45:25 +09:00

29 lines
642 B
C#

using System.Collections.Generic;
using System.Text;
namespace WelsonJS.Serialization
{
public class KVSerializer
{
private static Dictionary<string, string> dict = new Dictionary<string, string>();
public void Add(string key, string value)
{
dict[key] = value;
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
foreach (var x in dict)
{
sb.Append($"{x.Key}={x.Value}; ");
}
if (sb.Length > 0) sb.Length -= 2;
return sb.ToString();
}
}
}