public void Add(LibElemInst instantiation) { if (m_instanceNames.ContainsKey(instantiation.InstanceName)) { throw new ArgumentException("Instance name " + instantiation.InstanceName + " already used"); } m_instantiations.Add(instantiation); m_instanceNames.Add(instantiation.InstanceName, true); }
public void Remove(string instanceName) { if (!m_instanceNames.ContainsKey(instanceName)) { throw new ArgumentException("Instance name " + instanceName + " already used"); } // there should be only one element LibElemInst instToDelete = m_instantiations.FirstOrDefault(element => element.InstanceName == instanceName); m_instantiations.Remove(instToDelete); m_instanceNames.Remove(instanceName); }