gpt4 book ai didi

c# - List emailAddress 如何替换特定字符串中的值

转载 作者:太空宇宙 更新时间:2023-11-03 17:14:54 25 4
gpt4 key购买 nike

我有以下方法

/// <summary>
/// Replaces SemiColons with commas because SMTP client does not accept semi colons
/// </summary>
/// <param name="emailAddresses"></param>
public static List<string> ReplaceSemiColon(List<string> emailAddresses) // Note only one string in the list...
{
foreach (string email in emailAddresses)
{
email.Replace(";", ",");
}

//emailAddresses.Select(x => x.Replace(";", ",")); // Not working either


return emailAddresses;
}

但是电子邮件字符串并没有替换“;”与“,”。我错过了什么?

最佳答案

我认为您应该尝试将其设置回自身 email = email.Replace(";", ",");

关于c# - List<string> emailAddress 如何替换特定字符串中的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19053047/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com