Ejemplo n.º 1
0
        /// <summary>Setup a newly created object in its respective list, with an optional existing id</summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="list"></param>
        /// <param name="theObject"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        protected static T CreateObjectPostprocess <T>(Collections.ActiveList <T> list, T theObject, int id = TypeExtensions.kNone)
            where T : MegaloScriptModelObject
        {
            if (id.IsNone())
            {
                list.Add(theObject, out id);
                theObject.Id = id;
            }
            else
            {
                list.AddExplicit(theObject, id);
            }

            return(theObject);
        }
Ejemplo n.º 2
0
        /// <summary>Setup a newly created object in its respective list, with an optional existing id</summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="list"></param>
        /// <param name="obj"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        protected T CreateObjectPostprocess <T>(Collections.ActiveList <T> list, T obj, int id = TypeExtensions.kNone)
            where T : MegaloScriptModelObject
        {
            if (id.IsNone())
            {
                list.Add(obj, out id);
                obj.Id = id;
            }
            else
            {
                list.AddExplicit(obj, id);
            }

            return(obj);
        }