Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Type boxType = typeof(Box);

            FieldInfo[] fields = boxType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
            Console.WriteLine(fields.Count());

            var box = new Box();

            box.Length = double.Parse(Console.ReadLine());
            box.Width  = double.Parse(Console.ReadLine());
            box.Height = double.Parse(Console.ReadLine());
            box.PrintBox();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Type boxType = typeof(Box);

            FieldInfo[] fields = boxType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
            Console.WriteLine(fields.Count());

            var length = Convert.ToDouble(Console.ReadLine());
            var width  = Convert.ToDouble(Console.ReadLine());
            var height = Convert.ToDouble(Console.ReadLine());

            try
            {
                var box = new Box(length, width, height);
                box.PrintBox();
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemplo n.º 3
0
        public static void Main()
        {
            Box box = new Box(double.Parse(Console.ReadLine()), double.Parse(Console.ReadLine()), double.Parse(Console.ReadLine()));

            box.PrintBox();
        }