Example #1
0
        /// <summary>
        /// Create a LoadedTypeData object for serialization
        /// </summary>
        /// <param name="searchEntries"></param>
        /// <returns></returns>
        protected virtual object CreateObjectForSerialization(IEnumerable <NodeSearchElement> searchEntries)
        {
            var data = new LoadedTypeData <LoadedTypeItem>();

            // Converting searchEntries to another list so as to avoid modifying the actual searchEntries list when iterating through it.
            data.loadedTypes = searchEntries.ToList().Select(e => CreateLoadedTypeItem <LoadedTypeItem>(e)).ToList();
            return(data);
        }
Example #2
0
        /// <summary>
        /// Create a LoadedTypeData object for serialization
        /// </summary>
        /// <param name="searchEntries"></param>
        /// <returns></returns>
        protected override object CreateObjectForSerialization(IEnumerable <NodeSearchElement> searchEntries)
        {
            int w    = 0; //represents the weight
            var data = new LoadedTypeData <LoadedTypeItemExtended>();

            data.loadedTypes = searchEntries
                               .Select(e => CreateLoadedTypeItem <LoadedTypeItemExtended>(e).setWeight(w++)).ToList();
            return(data);
        }
        /// <summary>
        /// 构造LoadedTypeData对象用于序列化
        /// </summary>
        /// <param name="searchEntries"></param>
        /// <returns></returns>
        protected virtual object CreateObjectForSerialization(IEnumerable <NodeSearchElement> searchEntries)
        {
            var data = new LoadedTypeData <LoadedTypeItem>();

            data.loadedTypes = searchEntries
                               //.Where(e => !e.ElementType.HasFlag(ElementTypes.Packaged))
                               .Select(e => CreateLoadedTypeItem <LoadedTypeItem>(e)).ToList();
            return(data);
        }