Hi Everyone,
I keep getting this error for task 9 in the exercise Tracks On Tracks On Tracks:
We received the following error when we ran your code:
TracksOnTracksOnTracks.cs(28,91): error CS0029: Cannot implicitly convert type 'bool' to 'System.Collections.Generic.List<string>'
Here is my solution:
public static bool IsUnique(List<string> languages)
{
HashSet<string> set = new HashSet<string>();
foreach (string item in languages)
{
if (!set.Add(item))
return false;
}
return true;
}
I’m guessing the error is a faulty test implementation. I have also tried the LINQ solution below that generates the same error:
public static bool IsUnique(List<string> languages) => languages.Count == languages.Distinct().Count();