Пример #1
0
        public void PrintBunnyInfo(Bunny bunnies)
        {
            var consoleWriter = new ConsoleWriter();

            foreach (var bunny in bunnies)
            {
                bunny.Introduce(consoleWriter);
            }
        }
Пример #2
0
        public void WriteBuunyInfoToFile(string bunniesFilePath, Bunny bunnies)
        {
            var fileStream = File.Create(bunniesFilePath);

            fileStream.Close();

            var streamWriter = new StreamWriter(bunniesFilePath);

            using (streamWriter)
            {
                foreach (var bunny in bunnies)
                {
                    streamWriter.WriteLine(bunny.ToString());
                }
            }
        }