本文整理汇总了C#中Activity.ToXml方法的典型用法代码示例。如果您正苦于以下问题:C# Activity.ToXml方法的具体用法?C# Activity.ToXml怎么用?C# Activity.ToXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity.ToXml方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanSerialize
public void CanSerialize()
{
Activity a = new Activity();
a.At = DateTime.Parse("2008-07-01T19:19:36-04:00").ToUniversalTime();
a.Guid = "152623406";
a.Type = "dugg";
a.Uid = "joe";
Assert.AreEqual(@"<?xml version=""1.0"" encoding=""utf-8""?>
<activity xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" uid=""joe"" at=""2008-07-01T23:19:36Z"" guid=""152623406"" type=""dugg"" />",
a.ToXml());
Activities activities = new Activities();
activities.Add(a);
Assert.AreEqual(@"<?xml version=""1.0"" encoding=""utf-8""?>
<activities xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
<activity uid=""joe"" at=""2008-07-01T23:19:36Z"" guid=""152623406"" type=""dugg"" />
</activities>",
activities.ToXml());
}