I have a class Movie :
internal class Movie
{
public string Name { get; set; }
public string Year { get; set; }
}
And I have this code :
var Movies = CreateMovies(); //IEnumerable<Movie>
var sorter = new Sorter<Movie>();
sorter.AddSort(Movies, m => m.Year , a=>a.Name ,.....as many as I want....);
And here is the Sorter
class :
class Sorter<T>
{
public void AddSort(IEnumerable<T> movs, params Expression<Func<T, object>>[] funcs)
{
/*...*/
movs.OrderBy(d=>d.); //<----- here is the problem : where is the columns ?
}
}
Question :
When I need intellisence on the d
, it shows me :
I don't understand why T
is not inferred as Movie
:
Look how many locations are inferring that T
is a Movie
:
How can I make those Movie Fields to Appear , without changing to Ienumerable<Movies>
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…