本文整理汇总了C#中Post.Custom方法的典型用法代码示例。如果您正苦于以下问题:C# Post.Custom方法的具体用法?C# Post.Custom怎么用?C# Post.Custom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Post
的用法示例。
在下文中一共展示了Post.Custom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertPostToXML
protected static void ConvertPostToXML(Post post, XmlTextWriter writer)
{
writer.WriteStartElement("post");
writer.WriteAttributeString("id", post.Id.ToString());
writer.WriteElementString("title", post.Title);
writer.WriteElementString("body", post.Body);
writer.WriteElementString("postBody", post.PostBody);
writer.WriteElementString("extendedBody", post.ExtendedBody);
writer.WriteElementString("categoryId", post.CategoryId.ToString());
writer.WriteElementString("commentCount", post.CommentCount.ToString());
writer.WriteElementString("pendingCommentCount", post.PendingCommentCount.ToString());
writer.WriteElementString("author", post.UserName);
writer.WriteElementString("publishedDate", post.Published.ToString());
writer.WriteElementString("status", post.Status.ToString());
writer.WriteElementString("viewCount", post.Views.ToString());
writer.WriteElementString("url", new Macros().FullUrl(post.Url));
writer.WriteElementString("name", post.Name);
writer.WriteElementString("isDeleted", post.IsDeleted.ToString());
writer.WriteElementString("tags", post.TagList);
writer.WriteElementString("views", post.Views.ToString());
writer.WriteElementString("image", post.ImageUrl);
writer.WriteElementString("notes", post.Notes);
writer.WriteElementString("contenttype", post.ContentType);
writer.WriteElementString("revision", post.Version.ToString());
writer.WriteElementString("sortOrder", post.SortOrder.ToString());
writer.WriteElementString("modifiedBy", post.ModifiedBy);
writer.WriteElementString("createdBy", post.CreatedBy);
writer.WriteElementString("modifiedOn", post.ModifiedOn.ToString());
writer.WriteElementString("createdOn", post.CreatedOn.ToString());
writer.WriteElementString("enableComments", post.EnableComments.ToString());
writer.WriteElementString("isPublished", post.IsPublished.ToString());
writer.WriteElementString("isHome", post.IsHome.ToString());
writer.WriteElementString("homeSortOrder", post.HomeSortOrder.ToString());
writer.WriteElementString("parentId", post.ParentId.ToString());
writer.WriteElementString("metaDescription", post.MetaDescription);
writer.WriteElementString("metaKeywords", post.MetaKeywords);
writer.WriteElementString("isFeatured", (SiteSettings.Get().FeaturedId == post.Id).ToString());
writer.WriteElementString("isFeaturedCategory", (post.Category.FeaturedId == post.Id).ToString());
writer.WriteStartElement("customFields");
foreach(string key in post.CustomFields().AllKeys)
{
writer.WriteStartElement("customField");
writer.WriteAttributeString("key", key);
writer.WriteValue(post.Custom(key));
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteEndElement();
}