当我试图输出appointment.Categories值时,它是这样的:
但是它会将所有其他值输出到纯文本。
我尝试过ToString(),但这似乎行不通。
myText.InnerHtml += "subject::" + appointment.Subject + "\n";
myText.InnerHtml += "starttime::" + appointment.StartTime + "\n";
myText.InnerHtml += "endtime::" + appointment.EndTime + "\n";
myText.InnerHtml += "categori::" + appointment.Categories + "\n";这些是Microsoft http://msdn.microsoft.com/en-us/library/dd635637(v=exchg.80)的值。
如何将System.String输出到明文?
发布于 2012-06-06 10:07:55
类别不是字符串,而是字符串数组,您需要一次打印每个字符串。
替换
myText.InnerHtml += "categori::" + appointment.Categories + "\n";使用
foreach(var category in appointment.Categories)
{
myText.InnerHtml += "categori::" + category + "\n";
}发布于 2012-06-06 10:08:09
如何将System.String输出到明文?
这不是System.String。这是一个字符串数组。如何将字符串数组转换为单个字符串?例如,您可以使用:
string joined = string.Join(",", appointment.Categories);发布于 2012-06-06 10:08:19
看来appointment.Categories是字符串数组,而不是字符串。您可以使用以下内容:
myText.InnerHtml += "categori::" + String.Join(", ", appointment.Categories) + "\n";https://stackoverflow.com/questions/10912107
复制相似问题