Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            ArrayContainer arrayContainer = new ArrayContainer();

            arrayContainer.Add(new Student("Kozin Jr"));
            arrayContainer.Add(new Worker("Mr.Kozin"));
            arrayContainer.Add(new StudentWorker("Mr.Kozin I"));

            arrayContainer.Out();
            string input = Console.ReadLine();

            switch (input)
            {
                ""
            default:
                break;
            }
        }
Ejemplo n.º 2
0
        public static ArrayContainer ReadArrayAt(ref int i, string s)
        {
            if (s.Length - i < 2)
            {
                throw new Exception();
            }
            if (s[i] != '[')
            {
                throw new Exception();
            }
            ArrayContainer obj   = new ArrayContainer();
            int            index = 0;

            i++;

            if (s[i] != ']')
            {
                do
                {
                    obj.Add(new KeyValuePair <int, object>(index, ReadElementAt(ref i, s)));

                    if (s[i] != ',')
                    {
                        break;
                    }
                    else
                    {
                        i++;
                        index++;
                    }
                }while (true);

                if (s[i] != ']')
                {
                    throw new Exception();
                }
            }

            i++;
            return(obj);
        }