Exemplo n.º 1
0
        public override bool Equals(object obj)
        {
            NewStr myStr = obj as NewStr;

            if (myStr == null)
            {
                return(false);
            }
            return(myStr.str == this.str);
        }
Exemplo n.º 2
0
        public void Menu()
        {
            Console.WriteLine("Привет! Введите строку: " + Environment.NewLine);
            NewStr s1 = new NewStr {
                str = Console.ReadLine()
            };
            bool swBool = true;

            do
            {
                Console.WriteLine(Environment.NewLine + "Выберите действие:\n \n1. Конвертировать в массив символов \n2. Найти символ в строке \n3. Найти подстроку в строке \n4. Конвертировать в строку \n5. Индексатор \n6.Вызов DLL**  \n0. Выход ");
                string enter = Console.ReadLine();
                switch (enter)
                {
                case "1":
                    s1.ToCharArr();
                    break;

                case "2":
                    s1.SearchIndex();
                    break;

                case "3":
                    s1.SearchIndex();
                    break;

                case "4":
                    s1.ToStr();
                    break;

                case "5":
                    s1.GetIndexator();
                    break;

                case "6":
                    Helper.Hello();
                    break;

                case "0":
                    Console.WriteLine("Конец программы");
                    swBool = false;
                    break;

                default:
                    Console.WriteLine("Вы ввели неверное значение");
                    break;
                }
            }while (swBool);
        }
Exemplo n.º 3
0
        public void GetIndexator()
        {
            NewStr ind = new NewStr();

            Console.WriteLine("Вызываю индексатор и добавляю в него две строки");
            ind[0] = new NewStr {
                str = "Test String"
            };
            ind[1] = new NewStr {
                str = "One More Test String"
            };                                                         // Вызов индексатора

            NewStr TestInd1 = ind[0];
            NewStr TestInd2 = ind[1];

            Console.WriteLine("Первая строка: " + TestInd1.str);
            Console.WriteLine("Вторая строка: " + TestInd2.str);
        }
Exemplo n.º 4
0
 public NewStr()
 {
     data = new NewStr[5];
 }