I have Track
class
class Track
{
public String Name { get; set; }
public Double Duration;
public Boolean IsRemix;
public override string ToString()
{
if (IsRemix) return Name + "(Remix) " + Duration;
return Name + " " + Duration;
}
}
and Album
is a List:
class Album :List<Track>
{
public Album SortByAlphabet()
{
return new Album().OrderBy(x=>x.Name);
}
}
How can I order Album by Track's name? In SortByAlphabet I need only Album be output.
Edit
return this.OrderBy(x=>x.Name).ToList();
and
return (Album)this.OrderBy(x=>x.Name).ToList();
doesn't help
it's
throwing an exception, InvalidCastException