Church.Net.API/LineMessaging/Extensions/DictionaryExtensions.cs
2022-09-08 08:04:32 -07:00

17 lines
471 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
namespace LineMessaging
{
internal static class DictionaryExtensions
{
internal static string ToQueryString(this Dictionary<string, object> source)
{
if (source == null) throw new ArgumentNullException();
if (source.Count == 0) return string.Empty;
return "?" + string.Join("&", source.Select(x => $"{x.Key}={x.Value}"));
}
}
}