static void Main(string[] args)
        {
            // Creates and initializes a new ListDictionary.
            System.Collections.Specialized.ListDictionary listDictionary = new System.Collections.Specialized.ListDictionary();
            listDictionary.Add("Test1", "Test@123");
            listDictionary.Add("Admin", "Admin@123");
            listDictionary.Add("Temp", "Temp@123");
            listDictionary.Add("Demo", "Demo@123");
            listDictionary.Add("Test2", "Test2@123");
            listDictionary.Remove("Admin");
            if (listDictionary.Contains("Admin"))
            {
                Console.WriteLine("UserName already Esists");
            }
            else
            {
                listDictionary.Add("Admin", "Admin@123");
                Console.WriteLine("User added succesfully.");
            }

            // Get a collection of the keys.
            Console.WriteLine("UserName" + ": " + "Password");
            foreach (DictionaryEntry entry in listDictionary)
            {
                Console.WriteLine(entry.Key + ": " + entry.Value);
            }
            Console.ReadKey();
        }
Beispiel #2
0
        /// <summary>
        /// Function to update the world
        /// </summary>
        internal void update()
        {
            this.age++;

            foreach (Agent oneAgent in population.Values)
            {
                oneAgent.doStep();
                mainGUI.refreshPosition(oneAgent.Representation, (double)oneAgent.Position.X / this.width, (double)oneAgent.Position.Y / this.height);
                if (population.Count <= 0)
                {
                    break;
                }
            }

            //delete the dead agents
            foreach (Agent deadAgent in corps)
            {
                population.Remove(deadAgent.ID);
                mainGUI.remove(deadAgent.Representation);
            }
            corps.Clear();
        }