CsQuery.CQ.CreateFragment C# (CSharp) Method

CreateFragment() public static method

Create a new CQ object from a sequence of elements, or another CQ object.
public static CreateFragment ( IEnumerable elements ) : CQ
elements IEnumerable /// A sequence of elements. ///
return CQ
        public static CQ CreateFragment(IEnumerable<IDomObject> elements)
        {
            // this is synonymous with the Create method of the same sig because we definitely
            // would never autogenerate elements from a sequence of elements

            return Create(elements);
        }

Same methods

CQ::CreateFragment ( string html ) : CQ
CQ::CreateFragment ( string html, string context ) : CQ

Usage Example

コード例 #1
0
        /// <summary>
        /// Runs a set of HTML creation selectors and returns result as a single enumerable.
        /// </summary>
        ///
        /// <param name="content">
        /// A sequence of strings that are each valid HTML
        /// </param>
        ///
        /// <returns>
        /// A new sequence containing all the elements from all the selectors.
        /// </returns>

        protected IEnumerable <IDomObject> MergeContent(IEnumerable <string> content)
        {
            List <IDomObject> allContent = new List <IDomObject>();

            foreach (var item in content)
            {
                allContent.AddRange(CQ.CreateFragment(item));
            }
            return(allContent);
        }
All Usage Examples Of CsQuery.CQ::CreateFragment