// Copyright Epic Games, Inc. All Rights Reserved. using System; using System.Collections.Generic; using System.Text; namespace EpicGames.Core { /// /// Utility class for creating Http query strings /// public class QueryStringBuilder { readonly StringBuilder _builder = new StringBuilder(); /// /// Adds a new argument to the query string /// public void Add(string key, string value) { if (_builder.Length > 0) { _builder.Append('&'); } _builder.Append(key); _builder.Append('='); _builder.Append(Uri.EscapeDataString(value)); } /// /// Adds a set of arguments to the query string /// public void Add(string key, IEnumerable? values) { if (values != null) { foreach (string value in values) { Add(key, value); } } } /// public override string ToString() => _builder.ToString(); } }