public void SeeVideos(ConcreteVideoContent videoContent) { IVideoIterator iterator = videoContent.CreateNumerator(); while (iterator.HasNext()) { Video video = iterator.Next(); Console.WriteLine("Видео: \"" + video.Name + "\" посмотрел."); } }
static void Main(string[] args) { ConcreteVideoContent videoContent = new ConcreteVideoContent(); Viewer viewer = new Viewer(); viewer.SeeVideos(videoContent); Console.WriteLine("Введите видео"); var searchVideo = Console.ReadLine(); viewer.FindVideo(searchVideo); Console.Read(); }
public void FindVideo(string name) { /*if (string.IsNullOrWhiteSpace(name)) * { * throw new ArgumentNullException(nameof(name), "Name is null or empty"); * }*/ ConcreteVideoContent videoContent = new ConcreteVideoContent(); var d = videoContent[name]?.Name; if (d == null) { Console.WriteLine("Такого видео нет!!!"); } else { Console.WriteLine("Нашлось: \"" + videoContent[name].Name + "\" приятного просмотра"); } }