Problem is ICollection<T>
is not "Covariant". It seems GetLangIDList
method doesn't modify the list, it just queries the list. In that case you can use IEnumerable<T>
which is "Covariant".
public static List<String> GetLangIDList(IEnumerable<ILocalized> list)
{
//I want all the ID of the lang where car is translated for:
var somethin = list.Select(m => m.LCID_SpracheID.ToString()).ToList();
return somethin;
}
Read more about Covariance and Contravariance in Generics and Faq