I'm fairly new to C#, just started 2 days ago because I need to create simple project for my Coding classes at University, unfortunately we had 3 days to complete the code so I'm 1 day behind, but it doesn't matter. I created a list of tuples using code fount @ whatacode.wordpress.com.
public class TupleList<int, string, string, int, int, string, int>
: List<Tuple<int, string, string, int, int, string, int>>
{
public void Add(int IDL, string AlbNmL, string ArtL, int RelDL, int TrAmnL, string LocL, int RatL)
{
Add(new Tuple<int, string, string, int, int, string, int>(ID, AlbNm, Art, RelD, TrAmn, Loc, Rat));
}
}
I need to create list if it's first addition to tuple so I used if
if (currid == 0)
{
var Albums = new TupleList<int, string, string, int, int, string, int>
{
{ID, AlbNm, Art, RelD, TrAmn, Loc, Rat},
};
}
My ID, AlbNm, Art, RelD, TrAmn, Loc, Rat are result of readlines etc, doesn't really matter. (or does it??) I use currid as an indicator whether it's first or not (it start's with 0 and is ++ at the end of the add function.
Now my question is that how can I use the ADD method of my TupleList class in to add them (the ID, AlbNm, Art, RelD, TrAmn, Loc, Rat that I got from readlines) as a next tuple. I used
if(currid > 0)
but I don't really know what to put into that if. Hope my question is understandable in any % and that someone can help me :) Thanks in advance.
Would be much better to create an album class and make a list of albums
public class Album
{
public string Name {get;set;}
public string Artist {get; set;}
public Album(string _name, string _artist)
{
Name = _name;
Artist = _artist;
}
}
Album example = new Album("a", "good idea");
List<Album> listOfAlbums = new List<Album>();
listOfAlbums.Add(example);