간단한 클래스를 이용하여
Xml Write, Xml Read 기본예제 입니다.
public class CodeKiller
{
public String title;
}
public void ReadXML()
{
// Xml Write
var b = new CodeKiller { title = "Write Test" };
var writer = new System.Xml.Serialization.XmlSerializer(typeof(CodeKiller));
var wfile = new System.IO.StreamWriter(@"c:\temp\Sample.xml");
writer.Serialize(wfile, b);
wfile.Close();
// Xml Read
System.Xml.Serialization.XmlSerializer reader =
new System.Xml.Serialization.XmlSerializer(typeof(CodeKiller));
System.IO.StreamReader file = new System.IO.StreamReader(
@"c:\temp\Sample.xml");
CodeKiller overview = (CodeKiller)reader.Deserialize(file);
file.Close();
Console.WriteLine(overview.title);
}