Exemplo n.º 1
0
        public static void Test()
        {
            var(musicTracksId, artistsId) = MusicGenerator.GenerateMusicTrackId();
            var trackDetails = (
                from artist in artistsId
                where artist.Name == "Rob Miles"
                join track in musicTracksId on artist.Id equals track.ArtistId
                select new TrackDetails
            {
                ArtistName = artist.Name,
                Title = track.Title
            }
                );

            foreach (var track in trackDetails)
            {
                Console.WriteLine($"Artist: {track.ArtistName} Titile: {track.Title}");
            }
        }
Exemplo n.º 2
0
        public static void Test()
        {
            var(musicTracksId, artistsId) = MusicGenerator.GenerateMusicTrackId();
            var artistSummary = (
                from track in musicTracksId
                join artist in artistsId on track.ArtistId equals artist.Id
                group track by artist.Name
                into artistTrackSummary
                select new
            {
                Id = artistTrackSummary.Key,
                Count = artistTrackSummary.Count()
            }
                ).ToList();

            foreach (var item in artistSummary)
            {
                Console.WriteLine($"Artist: {item.Id} Tracks recorded: {item.Count}");
            }
        }