forked from jmmortega/CSharpCourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
72 lines (56 loc) · 2.37 KB
/
Copy pathProgram.cs
File metadata and controls
72 lines (56 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using CSharpCourse.ClassInterfacesAndStructs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSharpCourse.Collections
{
class Program
{
//NOTE: To reuse code, in this project there add the project CSharpCourse.ClassInterfacesAndStructs
static void Main(string[] args)
{
ListOfVideos();
StackOfCassetes();
MyMediaCollection();
QueueOfGenesisGames();
Console.ReadKey();
}
private static void ListOfVideos()
{
List<VHSVideo> vhsVideos = new List<VHSVideo>();
vhsVideos.Add(new VHSVideo(TimeSpan.FromMinutes(50)));
vhsVideos.Add(new VHSVideo(TimeSpan.FromMinutes(73)));
vhsVideos.Add(new VHSVideo(TimeSpan.FromMinutes(80)));
vhsVideos.Add(new VHSVideo(TimeSpan.FromMinutes(101)));
}
private static void StackOfCassetes()
{
Stack<CasetteMedia> stackOfCassetes = new Stack<CasetteMedia>();
stackOfCassetes.Push(new CasetteMedia() { Name = "Rock 70" });
stackOfCassetes.Push(new CasetteMedia() {Name = "Rock 80"});
stackOfCassetes.Push(new CasetteMedia() { Name = "Rock 90" });
CasetteMedia myFirstCassete = stackOfCassetes.Pop();
}
private static void MyMediaCollection()
{
Dictionary<int, Media> collection = new Dictionary<int, Media>();
collection.Add(1, new VHSVideo(TimeSpan.FromMinutes(53)));
collection.Add(2, new CasetteMedia());
collection.Add(3, new GenesisGame());
//Ups...
collection.Add(1, new BetaVideo(TimeSpan.FromMinutes(63)));
}
private static void QueueOfGenesisGames()
{
Queue<GenesisGame> genesisGames = new Queue<GenesisGame>();
genesisGames.Enqueue(new GenesisGame() { Name = "Sonic 1" });
genesisGames.Enqueue(new GenesisGame() { Name = "Sonic 2" });
genesisGames.Enqueue(new GenesisGame() { Name = "Sonic 3" });
//Nope! I don't play this game in a genesis...
genesisGames.Enqueue(new NesGame() { Name = "Super Mario Bros" });
GenesisGame whichSonic = genesisGames.Dequeue();
}
}
}