本文整理汇总了C#中AbsoluteTopicName.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# AbsoluteTopicName.ToString方法的具体用法?C# AbsoluteTopicName.ToString怎么用?C# AbsoluteTopicName.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbsoluteTopicName
的用法示例。
在下文中一共展示了AbsoluteTopicName.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FormatRSSTopicHistory
/// <summary>
/// Answer the RSS topic history for a given topic
/// </summary>
/// <param name="topic"></param>
/// <param name="useHTML"></param>
/// <returns></returns>
void FormatRSSTopicHistory(AbsoluteTopicName topic, bool useHTML, XmlWriter newsletter, IEnumerable changesForThisTopic)
{
ArrayList names = new ArrayList();
Hashtable changeInfo = new Hashtable(); // key = author, value = TopicChange
int count = 0;
foreach (TopicChange change in changesForThisTopic)
{
if (count >= MaxChanges)
{
break;
}
count++;
if (names.Contains(change.Author))
{
continue;
}
names.Add(change.Author);
changeInfo[change.Author] = change;
}
if (count == 0)
{
return;
}
if (useHTML)
{
Uri link = new Uri(TheLinkMaker.LinkToTopic(topic, true), false);
newsletter.WriteStartElement("a");
newsletter.WriteAttributeString("title", HTMLWriter.Escape(topic.Fullname));
newsletter.WriteAttributeString("href", link.AbsoluteUri);
newsletter.WriteString(HTMLWriter.Escape(topic.Name));
newsletter.WriteEndElement();
}
else
{
newsletter.WriteString(HTMLWriter.Escape(topic.Name));
}
newsletter.WriteString(
string.Format(" was most recently changed by: ")
);
bool firstName = true;
if (useHTML)
{
newsletter.WriteStartElement("ul");
}
foreach (string eachAuthor in names)
{
if (useHTML)
{
newsletter.WriteStartElement("li");
}
else
{
if (!firstName)
{
newsletter.WriteString(", ");
}
}
firstName = false;
newsletter.WriteString(HTMLWriter.Escape(eachAuthor) + " (" + ((TopicChange)(changeInfo[eachAuthor])).Timestamp.ToString() + ")");
if(useHTML)
{
newsletter.WriteEndElement();
}
}
if (useHTML)
{
newsletter.WriteEndElement();
Uri link = new Uri(TheLinkMaker.LinkToVersions(topic.ToString()), false);
newsletter.WriteString("View the ");
newsletter.WriteStartElement("a");
newsletter.WriteAttributeString("title", "Versions for " + HTMLWriter.Escape(topic.Fullname));
newsletter.WriteAttributeString("href", link.AbsoluteUri);
newsletter.WriteString("complete version history");
newsletter.WriteEndElement();
newsletter.WriteStartElement("br");
newsletter.WriteEndElement();
}
else
{
newsletter.WriteString("\n");
}
return;
}