static void Main(string[] args)
        {
            Cellphone samsung_s4 = new Cellphone(100, 200, 400, "Samsung ", "S4");

            Console.WriteLine("Vytvorený telefón {0} {1}", samsung_s4.brand, samsung_s4.model);
            Console.ReadKey();
        }
예제 #2
0
        /// <summary>
        /// Adds phones to the repository
        /// </summary>
        /// <param name="phone">Cellphone</param>
        public void Add(Cellphone phone)
        {
            if (phone == null)
            {
                throw new ArgumentNullException(nameof(phone));
            }

            var phoneString = JsonConvert.SerializeObject(phone);

            using (var streamWriter = new StreamWriter(RepositoryFilePath, true))
                streamWriter.WriteLine(phoneString);
        }