簡體   English   中英

無法從 IEnumerable 轉換<string>燒焦

[英]cannot convert from IEnumerable<string> to char

private async Task<string> GenerateQueryAsync(string month, IEnumerable<string> includedUsers)
{
    var queryTemplate = await _settingsService.GetAsync("Sat_Retest_Query_Template");
    var sb = new StringBuilder(queryTemplate.Value);
    sb.Replace("{startDate}", month + "/01");
    sb.Replace("{endDate}", GetNextYearMonth(month) + "/01");
    sb.Replace("{includedUsers}", includedUsers);
    return sb.ToString();
}

我該如何解決

無法從System.Collections.Generic.IEnumerable<string>轉換為char

對於IncludeUsers

您需要將 IEnumerable<string> 轉換為對您的情況有意義的某種形式的字符串。

例如,這顯示了如何將其轉換為 CSV,例如 ["one", "two"] 變為 "one, two"

var includedUsersCsv = string.Join(", ", includedUsers);
sb.Replace("{includedUsers}", includedUsersCsv);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM