/// <summary> /// Serialize method. /// </summary> public void Serialize <T>(T obj, string path) { ISerialiser serialiser = (ISerialiser)Serialiser; if (CheckISerialize) { if (obj is MarkerISerialize.ISerialize) { serialiser.Serialize(obj, path); } else { throw new System.InvalidCastException(); } } else { serialiser.Serialize(obj, path); } }
private void buttonSerialize_Click(object sender, EventArgs e) { if (this.listBoxItems.Items.Count != 0) { this.openFileDialogSr.Title = "Выберите файл"; if (openFileDialogSr.ShowDialog() != DialogResult.OK) { return; } if (openFileDialogSr.FileName != string.Empty) { serialiser.Serialize(openFileDialogSr.FileName, mainList, types); } MessageBox.Show("Сериализация выполнена"); } else { MessageBox.Show("Нечего сериализовать :("); } }
public void Serialize <T>(string fullPath, T sourceData) { _curSerialiser.Serialize(fullPath, sourceData); }