Files

22 lines
591 B
C#
Raw Permalink Normal View History

2026-08-12 14:04:55 +03:00
using System;
using System.Collections.Generic;
namespace RudderSdk.Core;
internal static class Url
{
public static string Encode(string? value) => Uri.EscapeDataString(value ?? string.Empty);
public static string Query(params (string Key, string? Value)[] values)
{
var parts = new List<string>();
foreach (var item in values)
{
if (!string.IsNullOrEmpty(item.Value))
parts.Add(Encode(item.Key) + "=" + Encode(item.Value));
}
return parts.Count == 0 ? string.Empty : "?" + string.Join("&", parts);
}
}