CsQuery.CQ.Create C# (CSharp) Method

Create() public static method

Create a new CQ object from a single element. Unlike the constructor method CsQuery.CQ this new objet is not bound to any context from the element.
public static Create ( IDomObject element ) : CQ
element IDomObject /// The element to wrap ///
return CQ
        public static CQ Create(IDomObject element)
        {
            CQ csq = new CQ();
            if (element is IDomDocument) {
                csq.Document = (IDomDocument)element;
                csq.AddSelection(csq.Document.ChildNodes);
            } else {
                csq.CreateNewFragment(Objects.Enumerate(element));
            }
            return csq;
        }

Same methods

CQ::Create ( ) : CQ
CQ::Create ( IEnumerable elements ) : CQ
CQ::Create ( System.Stream html ) : CQ
CQ::Create ( System.Stream html, Encoding encoding ) : CQ
CQ::Create ( System.Stream html, Encoding encoding = null, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : CQ
CQ::Create ( System.Text.TextReader html ) : CQ
CQ::Create ( System.Text.TextReader html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : CQ
CQ::Create ( char html ) : CQ
CQ::Create ( string html ) : CQ
CQ::Create ( string html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : CQ
CQ::Create ( string html, object quickSet ) : CQ

Usage Example

コード例 #1
0
ファイル: CQ.cs プロジェクト: asmboom/HtmlRenderer
        /// <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.Create(item));
            }
            return(allContent);
        }
All Usage Examples Of CsQuery.CQ::Create