Browsed by
Month: April 2016

Transform object to another type in a LINQ query

Transform object to another type in a LINQ query

I had the following problem: let’s say I have a class called “Song”. I want to load it from the database and transform it to a data transfer object class called “SongDto” which includes only a subset of the original Song class’s properties. class Song { public string Name { get; set; } public int Length { get; set; } public string Description { get; set; } public string Artists { get; set; } } class SongDto { public string Name…

Read More Read More