This article describes the reading and writing methods of C# implementing xml files. Share it for your reference. The details are as follows:
//DataTable DateSet can be used to read and write xml dataprotected voidButton1_Click(object sender, EventArgs e) { DataTabledt = new DataTable("Employee"); DataColumndcID = new DataColumn("ID", typeof(string)); DataColumndcName = new DataColumn("NAME", typeof(string)); DataColumndcAGE = new DataColumn("AGE", typeof(string)); DataColumndcDEPT = new DataColumn("DEPT", typeof(string)); (new DataColumn[] {dcID, dcName, dcAGE, dcDEPT }); DataRowdr = (); dr["ID"]= "3"; dr["NAME"]= "chen"; dr["AGE"]= "21"; dr["DEPT"]= "Technology Department"; (dr); DataSetds2 = new DataSet(); (dt); DataSetds = new DataSet(); (("")); (ds2);//Merge data (("")); (GetType(), "", "alert('Writing successfully')",true); } protected voidButton2_Click(object sender, EventArgs e) { DataSetds = new DataSet(); (("")); = ds; (); }
I hope this article will be helpful to everyone's C# programming.