我想建立一个电子邮件模板。我得到了什么是假设的工作示例,但我在尝试获取FormatWith()以解决其中一个函数时出现问题。我想使用一个函数,使用FormatWith(),我得到一个错误在C#
private static string PrepareMailBodyWith(string templateName, params string[] pairs)
{
string body = GetMailBodyOfTemplate(templateName);
for (var i = 0; i < pairs.Length; i += 2)
{
// wonder if I can bypass Format with and just use String.Format
body = body.Replace("<%={0}%>".FormatWith(pairs[i]), pairs[i + 1]);
//body = body.Replace("<%={0}%>",String.Format(pairs[i]), pairs[i + 1]);
}
return body;
}
我已经包括所有这些NameSpaces试图解决它。 'using System;使用System.IO的 ; using System.Collections.Generic;使用System.Linq的 ; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Net.Mail; using System.Net.Mime; using System.Web.Configuration; using System.Net.Configuration; using System.Configuration;使用System.Globalization的 ; using System.String;使用System.IFormatProvider的 ;使用System.Object;' – user1830640