Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 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 Item[] ItemStack = new Item[5];
  13.         }
  14.  
  15.         public class Item
  16.             {
  17.             public string Name { get; set; }
  18.             public string Directory { get; set; }
  19.             public string Norm_prefix { get; set; }
  20.             public string Spec_prefix { get; set; }
  21.             }
  22.  
  23.         private void Form1_Load(object sender, EventArgs e)
  24.         {
  25.             Profile myObject = new Profile();
  26.             XmlSerializer mySerializer = new
  27.             XmlSerializer(typeof(Profile));
  28.  
  29.             myObject.Itemstack.Name = "canvas"; // How do i put things into the class Profile ?
  30.            
  31.             StreamWriter myWriter = new StreamWriter("c:/myFileName.xml");
  32.             mySerializer.Serialize(myWriter, myObject);
  33.             myWriter.Close();
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement