Add Artists Serialization

pull/22/head
Louis LABORIE 2 years ago
parent 4c6cf42e79
commit ed203a9997

@ -182,4 +182,22 @@ public class LINQ_XML_Serialization : IDataManager
}
}
}
public void LoadArtists()
{
XDocument ArtistsFile = XDocument.Load("artists.xml");
artists = ArtistsFile.Descendants("artist")
.Select(eltArtist => new Artist(
eltArtist.Attribute("Name")!.Value
)).ToList();
}
public void SaveArtists()
{
XDocument ArtistsFile = new XDocument();
var artist = artists.Select(artist => new XElement("artist",
new XAttribute("Name", artist.Name)
));
}
}

Loading…
Cancel
Save