Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1. namespace WindowsFormsApplication7
  2. {
  3.     public partial class Form1 : Form
  4.     {
  5.         public Form1()
  6.         {
  7.             InitializeComponent();
  8.         }
  9.  
  10.         public class Profile
  11.         {
  12.             public String Name;
  13.             public int ageOrSomeOtherStuff;    
  14.         }
  15.  
  16.         public class Item
  17.             {
  18.             public string Name { get; set; }
  19.             public string Directory { get; set; }
  20.             public string Norm_prefix { get; set; }
  21.             public string Spec_prefix { get; set; }
  22.             }
  23.  
  24.         private void Form1_Load(object sender, EventArgs e)
  25.         {
  26.             Profile myObject = new Profile();
  27.             XmlSerializer mySerializer = new
  28.             XmlSerializer(typeof(Profile));
  29.  
  30.             myObject.Itemstack.Name = "canvas"; // How do i put things into the class Profile ?
  31.            
  32.             StreamWriter myWriter = new StreamWriter("c:/myFileName.xml");
  33.             mySerializer.Serialize(myWriter, myObject);
  34.             myWriter.Close();
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement