当前位置: 首页>>代码示例>>C#>>正文


C# ITextBuffer.ToDocument方法代码示例

本文整理汇总了C#中ITextBuffer.ToDocument方法的典型用法代码示例。如果您正苦于以下问题:C# ITextBuffer.ToDocument方法的具体用法?C# ITextBuffer.ToDocument怎么用?C# ITextBuffer.ToDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITextBuffer的用法示例。


在下文中一共展示了ITextBuffer.ToDocument方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseTemplate

        /// <summary>
        /// Parses the template specified by the TextBuffer and returns it's result
        /// </summary>
        /// <remarks>
        /// <para>
        /// IMPORTANT: This does NOT need to be called before GeneratedCode! GenerateCode will automatically
        /// parse the document first.
        /// </para>
        /// <para>
        /// The cancel token provided can be used to cancel the parse.  However, please note
        /// that the parse occurs _synchronously_, on the callers thread.  This parameter is
        /// provided so that if the caller is in a background thread with a CancellationToken,
        /// it can pass it along to the parser.
        /// </para>
        /// </remarks>
        /// <param name="input">The input text to parse.</param>
        /// <param name="cancelToken">A token used to cancel the parser.</param>
        /// <returns>The resulting parse tree.</returns>
        public ParserResults ParseTemplate(ITextBuffer input, CancellationToken? cancelToken)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            return ParseTemplateCore(input.ToDocument(), sourceFileName: null, cancelToken: cancelToken);
        }
开发者ID:x-strong,项目名称:Razor,代码行数:27,代码来源:RazorTemplateEngine.cs

示例2: ParseTemplate

 public ParserResults ParseTemplate(ITextBuffer input, CancellationToken? cancelToken)
 {
     return ParseTemplateCore(input.ToDocument(), cancelToken);
 }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:4,代码来源:RazorTemplateEngine.cs

示例3: GenerateCode

        /// <summary>
        /// Parses the template specified by the TextBuffer, generates code for it, and returns the constructed code.
        /// </summary>
        /// <remarks>
        /// <para>
        /// The cancel token provided can be used to cancel the parse.  However, please note
        /// that the parse occurs _synchronously_, on the callers thread.  This parameter is
        /// provided so that if the caller is in a background thread with a CancellationToken,
        /// it can pass it along to the parser.
        /// </para>
        /// <para>
        /// The className, rootNamespace and sourceFileName parameters are optional and override the default
        /// specified by the Host.  For example, the WebPageRazorHost in System.Web.WebPages.Razor configures the
        /// Class Name, Root Namespace and Source File Name based on the virtual path of the page being compiled.
        /// However, the built-in RazorEngineHost class uses constant defaults, so the caller will likely want to
        /// change them using these parameters.
        /// </para>
        /// </remarks>
        /// <param name="input">The input text to parse.</param>
        /// <param name="cancelToken">A token used to cancel the parser.</param>
        /// <param name="className">
        /// The name of the generated class, overriding whatever is specified in the Host.  The default value (defined
        /// in the Host) can be used by providing null for this argument.
        /// </param>
        /// <param name="rootNamespace">The namespace in which the generated class will reside, overriding whatever is
        /// specified in the Host.  The default value (defined in the Host) can be used by providing null for this
        /// argument.
        /// </param>
        /// <param name="sourceFileName">
        /// The file name to use in line pragmas, usually the original Razor file, overriding whatever is specified in
        /// the Host.  The default value (defined in the Host) can be used by providing null for this argument.
        /// </param>
        /// <returns>The resulting parse tree AND generated code.</returns>
        public GeneratorResults GenerateCode(
            ITextBuffer input,
            string className,
            string rootNamespace,
            string sourceFileName,
            CancellationToken? cancelToken)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            return GenerateCodeCore(
                input.ToDocument(),
                className,
                rootNamespace,
                sourceFileName,
                checksum: null,
                cancelToken: cancelToken);
        }
开发者ID:x-strong,项目名称:Razor,代码行数:53,代码来源:RazorTemplateEngine.cs

示例4: GenerateCode

 public GeneratorResults GenerateCode(ITextBuffer input, string className, string rootNamespace, string sourceFileName, CancellationToken? cancelToken)
 {
     return GenerateCodeCore(input.ToDocument(), className, rootNamespace, sourceFileName, cancelToken);
 }
开发者ID:KevMoore,项目名称:aspnetwebstack,代码行数:4,代码来源:RazorTemplateEngine.cs


注:本文中的ITextBuffer.ToDocument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。