public static void Test()
        {
            int pageNo      = 0;
            int pageSize    = 2;
            var musicTracks = MusicGenerator.GenerateMusicTrack();

            while (true)
            {
                var trackList = (
                    from musicTrack in musicTracks.Skip(pageNo * pageSize).Take(pageSize)
                    select new TrackDetails
                {
                    ArtistName = musicTrack.Artist.Name,
                    Title = musicTrack.Title
                }
                    ).ToList();
                if (trackList.Count == 0)
                {
                    break;
                }
                foreach (var track in trackList)
                {
                    Console.WriteLine($"Artist: {track.ArtistName} Titile: {track.Title}");
                }

                pageNo++;
            }
        }
Beispiel #2
0
        public static void Test()
        {
            var musicTracks    = MusicGenerator.GenerateMusicTrack();
            var selectedTracks =
                (from track in musicTracks
                 where track.Artist.Name == "Rob Miles"
                 select track).ToList();

            foreach (var track in selectedTracks)
            {
                Console.WriteLine($"Artist: {track.Artist.Name} Titile: {track.Title}");
            }
        }
        public static void Test()
        {
            var musicData = MusicGenerator.GenerateMusicTrack();
            var formatter = new BinaryFormatter();

            using (FileStream outputStream = new FileStream("MusicTracks.bin", FileMode.OpenOrCreate, FileAccess.Write))
            {
                formatter.Serialize(outputStream, musicData);
            }

            using (FileStream inputStream = new FileStream("MusicTracks.bin", FileMode.Open, FileAccess.Read))
            {
                var inputData = (IList <MusicTrack>)formatter.Deserialize(inputStream);
            }
        }