コード例 #1
0
        static void Main()
        {
            // create a new list box and initialize
            ListBoxTest lbt =
                new ListBoxTest("Hello", "World");

            // add a few strings
            lbt.Add("Who");
            lbt.Add("Is");
            lbt.Add("John");
            lbt.Add("Galt");

            // test the access
            string subst = "Universe";

            lbt[1]     = subst;
            lbt["Hel"] = "GoodBye";
            // lbt["xyz"] = "oops";

            // access all the strings
            for (int i = 0; i < lbt.GetNumEntries(); i++)
            {
                Console.WriteLine("lbt[{0}]: {1}", i, lbt[i]);
            }   // end for
        }       // end main
コード例 #2
0
ファイル: 10.cs プロジェクト: nanohaikaros/csharp_learn
        static void Main()
        {
            ListBoxTest lbt = new ListBoxTest("Hello", "World");

            lbt.Add("Who");
            lbt.Add("Is");
            lbt.Add("John");
            lbt.Add("Galt");

            string subst = "Universe";

            lbt[1]     = subst;
            lbt["Hel"] = "GoodBye";

            for (int i = 0; i < lbt.GetNumEntries(); i++)
            {
                Console.WriteLine("lbt[{0}]: {1}", i, lbt[i]);
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: jasarsoft/examples
        static void Main()
        {
            //pravi novi popis i inicijalizira ga
            ListBoxTest lbt = new ListBoxTest("Hello", "World");

            //dodaje nekoliko nizova
            lbt.Add("Who");
            lbt.Add("Is");
            lbt.Add("John");
            lbt.Add("Galt");

            //testira pristup
            string subst = "Universe";

            lbt[1]     = subst;
            lbt["Hel"] = "GoodBay";
            //lbt["xyz"]= "oops";

            //pristupa svim nizovima
            for (int i = 0; i < lbt.GetNumEntries(); i++)
            {
                Console.WriteLine("lbt[{0}]: {1}", i, lbt[i]);
            }
        }