我有以下方法

/// <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(";", ",");

10-06 03:26