在我的項目上工作。我必須做數據序列化。如何在C#中進行數據序列化?
我有一個代碼,但我不知道如何在其上應用序列化。
public class allmethods
{
private static string Name;
private static int ID;
private static int Age;
private static string Email;
private static string output;
public static void WritingMethod()
{
int count = 0;
while (count < 10)
{
Console.Write(" Enter your Name: ");
Name = Console.ReadLine();
Console.Write(" Enter your ID: ");
ID = int.Parse(Console.ReadLine());
Console.Write(" Enter your Age: ");
Age = int.Parse(Console.ReadLine());
Console.Write(" Enter your E-mail: ");
Email = Console.ReadLine();
StreamWriter Sw = new StreamWriter("fileone.txt", true);
string output = string.Format("Thank you for registration! Your Submitted information are:" + Environment.NewLine + "Name: {0}"
+ Environment.NewLine + "ID: {1}" + Environment.NewLine + "Age: {2}" + Environment.NewLine + "E-mail: {3}", Name, ID, Age, Email);
Console.WriteLine(output);
Sw.WriteLine(output + Environment.NewLine);
Console.ReadLine();
Sw.Close();
count++;
}
}
}
如果有人幫助我,我會很高興。謝謝。
你想什麼連載以此爲 – 2013-04-26 06:06:03
一個簡單的,低掛水果入手:C#和DOM(XML序列化) :HTTP:// w^ww.mastercsharp.com/Article/69/working-with-xml-dom – Najzero 2013-04-26 06:06:46