private void loadObjectToolStripMenuItem_Click(object sender, EventArgs e) { using (OpenFileDialog openFileDialog = new OpenFileDialog()) { openFileDialog.Filter = ".XML files (*.xml)|*.xml"; if (openFileDialog.ShowDialog() == DialogResult.OK) { serializationTestObject = (SerializationTestClass)ObjectXmlSerializer. ObtainSerializedObject(openFileDialog.FileName, typeof(SerializationTestClass)); ShowTestObject(); } } }
public MainForm() { InitializeComponent(); serializationTestObject = new SerializationTestClass(); serializationTestObject.IntParameter = 1; serializationTestObject.DoubleParameter = 5.0; serializationTestObject.DoubleParameter2 = 2.0; serializationTestObject.IntegerList = new List <int>() { 1, 5, 6, 3, 6, 1 }; ShowTestObject(); }