public static void Main(string[] args) { try { var to = new Training("descriptionf"); to.Add(new Text("some text", "description")); to.Add(new Video(VideoType.Avi, "some text", "some text", "description")); to.Add(new Reference("some text", ReferenceType.Image, "description")); to.Add(new Video(VideoType.Mp4, "ref", description: "description")); var to2 = to.Clone(); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadKey(); }
public object Clone() { var materials = new Material[_materials.Length]; for (var i = 0; i < _materials.Length; i++) { materials[i] = _materials[i].Copy(); } var copyVersion = new byte[_version.Length]; for (var i = 0; i < _version.Length; i++) { copyVersion[i] = _version[i]; } var clone = new Training { _materials = materials, Description = Description, Id = Id, _version = copyVersion }; return(clone); }