Пример #1
0
        public void CustomString()
        {
            SystemString normalstring = new SystemString();
            string       name         = "Carlos";
            int          length       = name.Length;

            normalstring.word = name;
            normalstring.Insert(normalstring.word);
            normalstring.Remove(2, 3);
            Console.WriteLine(normalstring.ToString());
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("SystemString");
            SystemString systemString = new SystemString("Hello");
            Console.WriteLine(systemString.Length());
            systemString.Insert(5, " World!");
            Console.WriteLine(systemString);
            systemString.Insert(5, ",");
            Console.WriteLine(systemString);
            systemString.Remove(0, 7);
            Console.WriteLine(systemString);

            Console.WriteLine("SystemArrayString");
            SystemArrayString systemArrayString = new SystemArrayString("Hello");
            Console.WriteLine(systemArrayString.Length());
            systemArrayString.Insert(5, " World!");
            Console.WriteLine(systemArrayString);
            systemArrayString.Insert(5, ",");
            Console.WriteLine(systemArrayString);
            systemArrayString.Remove(0, 7);
            Console.WriteLine(systemArrayString);

            Console.WriteLine("SystemLinkedListString");
            SystemLinkedListString systemLinkedListString = new SystemLinkedListString("Hello");
            Console.WriteLine(systemLinkedListString.Length());
            systemLinkedListString.Insert(5, " World!");
            Console.WriteLine(systemLinkedListString);
            systemLinkedListString.Insert(5, ",");
            Console.WriteLine(systemLinkedListString);
            systemLinkedListString.Remove(0, 7);
            Console.WriteLine(systemLinkedListString);

            Console.WriteLine("CustomSystemLinkedListString");
            CustomLinkedListString customLinkedListString = new CustomLinkedListString("Hello");
            Console.WriteLine(customLinkedListString);
            Console.WriteLine(customLinkedListString.Length());
            customLinkedListString.Insert(5, " World!");
            Console.WriteLine(customLinkedListString);
            Console.WriteLine(customLinkedListString.Length());
            customLinkedListString.Insert(5, ",");
            Console.WriteLine(customLinkedListString);
            Console.WriteLine(customLinkedListString.Length());
            customLinkedListString.Remove(0, 7);
            Console.WriteLine(customLinkedListString);
            Console.WriteLine(customLinkedListString.Length());

            Console.ReadKey();
        }