本文整理汇总了C#中System.Xml.Linq.XStreamingElement.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# XStreamingElement.ToString方法的具体用法?C# XStreamingElement.ToString怎么用?C# XStreamingElement.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Linq.XStreamingElement
的用法示例。
在下文中一共展示了XStreamingElement.ToString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToString
public void ToString ()
{
var el = new XStreamingElement ("foo",
new XAttribute ("bar", "baz"),
"text");
Assert.AreEqual ("<foo bar=\"baz\">text</foo>", el.ToString ());
}
示例2: ToStringAttributeAfterText
public void ToStringAttributeAfterText ()
{
var el = new XStreamingElement ("foo",
"text",
new XAttribute ("bar", "baz"));
el.ToString ();
}
示例3: XNameConstructor
public void XNameConstructor()
{
XStreamingElement streamElement = new XStreamingElement("contact");
Assert.Equal("<contact />", streamElement.ToString());
}
示例4: XNameAndNullObjectConstructor
public void XNameAndNullObjectConstructor()
{
XStreamingElement streamElement = new XStreamingElement("contact", null);
Assert.Equal("<contact />", streamElement.ToString());
}
示例5: AddWithNull
public void AddWithNull()
{
XStreamingElement streamElement = new XStreamingElement("contact");
streamElement.Add(null);
Assert.Equal("<contact />", streamElement.ToString());
}
示例6: XMLPropertyGet
public void XMLPropertyGet()
{
XElement contact = new XElement("contact", new XElement("phone", "925-555-0134"));
XStreamingElement streamElement = new XStreamingElement("contact", contact.Element("phone"));
Assert.Equal(contact.ToString(SaveOptions.None), streamElement.ToString(SaveOptions.None));
}
示例7: XNameConstructor
//[Variation(Priority = 0, Desc = "Constructor - XStreamingElement(XName)")]
public void XNameConstructor()
{
XStreamingElement streamElement = new XStreamingElement("contact");
if (!streamElement.ToString().Equals("<contact />"))
throw new TestFailedException("");
}
示例8: AddWithNull
//[Variation(Priority = 1, Desc = "Add(null)")]
public void AddWithNull()
{
XStreamingElement streamElement = new XStreamingElement("contact");
streamElement.Add(null);
if (!streamElement.ToString().Equals("<contact />"))
throw new TestFailedException("");
}
示例9: XMLPropertyGet
//[Variation(Priority = 0, Desc = "XML Property")]
public void XMLPropertyGet()
{
XElement contact = new XElement("contact", new XElement("phone", "925-555-0134"));
XStreamingElement streamElement = new XStreamingElement("contact", contact.Element("phone"));
if (!streamElement.ToString(SaveOptions.None).Equals(contact.ToString(SaveOptions.None)))
throw new TestFailedException("");
}