コード例 #1
0
        /// <summary>
        /// Returns false if the entry already exists
        /// </summary>
        /// <param name="entry"></param>
        /// <returns></returns>
        public bool AddEntry(SettingsEntry entry)
        {
            var type = entry.GetType();

            if (EntryExists(type))
            {
                return(false);
            }

            m_entries.Add(entry);
            return(true);
        }
コード例 #2
0
        public bool AddOrSetEntry(SettingsEntry entry)
        {
            var type = entry.GetType();

            if (EntryExists(type))
            {
                if (!RemoveEntry(type))
                {
                    throw new Exception(string.Format("Entry {0} already exists but cannot be removed for an unknow reason", type));
                }
            }


            m_entries.Add(entry);
            return(true);
        }