コード例 #1
0
        static void Main(string[] args)
        {
            var stations = new StationList();
            var station1 = new RadioStation(89);

            stations.Add(station1);

            var station2 = new RadioStation(101);

            stations.Add(station2);

            var station3 = new RadioStation(102);

            stations.Add(station3);

            foreach (var x in stations)
            {
                Console.Write(x.GetFrequecy());
            }

            var q = stations.Where(x => x.GetFrequecy() == 89).FirstOrDefault();

            Console.WriteLine(q.GetFrequecy());

            Console.ReadLine();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var stations = new StationList();
            var station1 = new RadioStation(89);

            stations.AddStation(station1);

            var station2 = new RadioStation(101);

            stations.AddStation(station2);

            var station3 = new RadioStation(102);

            stations.AddStation(station3);

            foreach (RadioStation station in stations)
            {
                Console.WriteLine(station.GetFrequecy());
            }

            stations.RemoveStation(station2); // Will Remove station 101

            Console.ReadLine();
        }
コード例 #3
0
 public void RemoveStation(RadioStation station)
 {
     mStations.Remove(station);
 }
コード例 #4
0
 public void AddStation(RadioStation station)
 {
     mStations.Add(station);
 }