本文整理汇总了C#中DataCollection.XmlSerialize方法的典型用法代码示例。如果您正苦于以下问题:C# DataCollection.XmlSerialize方法的具体用法?C# DataCollection.XmlSerialize怎么用?C# DataCollection.XmlSerialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataCollection
的用法示例。
在下文中一共展示了DataCollection.XmlSerialize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: op_OnChanged
public void op_OnChanged()
{
using (var temp = new TempDirectory())
{
var file = temp.Info.ToFile("example.xml");
var expected = new DataCollection
{
{
"foo", "bar"
}
};
file.Create(expected.XmlSerialize());
var actual = ConfigXml.Load<DataCollection>(file);
file.Create(expected.XmlSerialize());
Assert.Equal(expected, actual.Value);
}
}
示例2: op_Xml_Assembly
public void op_Xml_Assembly()
{
var file = new FileInfo(typeof(DataCollection).Assembly.Location + ".xml");
try
{
var expected = new DataCollection
{
{
"foo", "bar"
}
};
file.Create(expected.XmlSerialize());
var actual = Config.Xml<DataCollection>(typeof(DataCollection).Assembly);
Assert.Equal(expected, actual);
}
finally
{
file.Refresh();
if (file.Exists)
{
file.Delete();
}
}
}
示例3: xml_serialize
public void xml_serialize()
{
var obj = new DataCollection
{
{
"foo", "bar"
}
};
Assert.True(obj.XmlSerialize().CreateNavigator().Evaluate<bool>("1=count(/data/value[@name='foo'][text()='bar'])"));
}
示例4: op_ToString
public void op_ToString()
{
var obj = new DataCollection
{
{
"name1", "value1"
},
{
"name2", "value2"
}
};
var expected = obj.XmlSerialize().CreateNavigator().OuterXml;
var actual = obj.ToString();
Assert.Equal(expected, actual);
}