public void AddAgent(AgentRole role, bool status, string name)
        {
            AgentStateStatic  newAgentStateStatic  = new AgentStateStatic();
            AgentStateDynamic newAgentStateDynamic = new AgentStateDynamic();

            newAgentStateStatic.AssignRole(role);
            newAgentStateStatic.SetName(name);
            newAgentStateDynamic.SetStatus(status);

            agents.Add(newAgentStateStatic, newAgentStateDynamic);

            // Очистка
            newAgentStateStatic  = null;
            newAgentStateDynamic = null;
            GC.Collect();

            UpdateHashCode();
        }
        /// <summary>
        /// Add the agent to the existing collection of agents using only the specified role and name.
        /// </summary>
        /// <param name="role"></param>
        /// <param name="name"></param>
        public void AddAgent(AgentRole role, string name)
        {
            // Create empty instances of the static and dynamic parts of the agent.
            AgentStateStatic  newAgentStateStatic  = new AgentStateStatic();
            AgentStateDynamic newAgentStateDynamic = new AgentStateDynamic();

            // Assign the role and name of the static part.
            newAgentStateStatic.AssignRole(role);
            newAgentStateStatic.SetName(name);

            // We give the dynamic part a link to the static part.
            newAgentStateDynamic.SetAgentInfo(newAgentStateStatic);

            // We combine both parts into one and add to the collection.
            agents.Add(newAgentStateStatic, newAgentStateDynamic);

            // Очистка
            newAgentStateStatic  = null;
            newAgentStateDynamic = null;
            GC.Collect();

            UpdateHashCode();
        }