writing an mp3 player in c#, use dictionary or array for metadata? -


i'm writing mp3 player in c#, , i'm wondering how store metadata quick retrieval. here's data need store each individual file:

  • file location
  • file name
  • artist
  • album
  • track title
  • album artwork

how should store data? dictionary of arrays? dictionary of dictionaries? want populate listbox individual entries, if have button says artist, artist info, put in array , populate listbox.

how generic list?

// define song object. public class song  {     public string filelocation { get; set; }     public string filename { get; set; }     public string artist { get; set; }     public string album { get; set; }     public string tracktitle { get; set; }     public string albumartwork { get; set; } }  // create list of songs. list<song> songs = new list<song>();  // add new song list. songs.add(new song {         filelocation = "/filepath/sade.mp3",         filename = "sade",          artist = "sade",          album = "sade",          tracktitle = "smooth operator",          albumartwork "tbd" });  // access first song in list. song song = songs[0];  // access property of song. string tracktitle = song.tracktitle; 

of course break down more object-oriented design making song properties complex objects well. example:

public class album {     public string name     public datetime releasedate     public string artwork { get; set; } }  public class artist {     public string name     public list<album> albums }  public class song  {     public string filelocation { get; set; }     public string filename { get; set; }     public artist artist { get; set; }     public string tracktitle { get; set; } } 

and then, example, access album properties this:

string firstalbumname = song.artist.albums[0].name; 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -