First of all,
System.Collections.Generic.Dictionary<TKey, TValue>
has two generic parameters, not one. The access is done via the keys, so you need a type for a key and a type for a value. The key should be unique. What is it? Say, the full title of the song, then a string. If not, it could be a combination of the title, the year of first release and the names of the authors. In this case, you need a class or a structure of the keys. Also, you need to override the equivalence/identity methods in the key type with its
GetHashCode
; the hash code override is actually formally required if you override
System.Object.Equals
and is actually used by key/value associated containers.
Please see:
http://msdn.microsoft.com/en-us/library/system.object.aspx[
^],
http://msdn.microsoft.com/en-us/library/xfhwa508.aspx[
^].
One minor problem is redundant
Directory
and
Name
(file name in your interpretation). This is just a design bug (please see:
http://en.wikipedia.org/wiki/Don%27t_repeat_yourself[
^]). In this way, it's possible to create instances contradicting to each other. Never do such things. Say, introduce a full-path
FileName
; but you can also have properties for file name and directory, but returning values on the fly based on full name and the use of
System.IO.Path
methods.
—SA