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


C# BaseMethodDeclarationSyntax.GetExpressionBodySyntax方法代码示例

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


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

示例1: IsInBody

        /// <summary>
        /// A position is inside a body if it is inside the block or expression
        /// body. 
        ///
        /// A position is considered to be inside a block if it is on or after
        /// the open brace and strictly before the close brace. A position is
        /// considered to be inside an expression body if it is on or after
        /// the '=>' and strictly before the semicolon.
        /// </summary>
        internal static bool IsInBody(int position, BaseMethodDeclarationSyntax method)
        {
            var exprOpt = method.GetExpressionBodySyntax();

            return IsInExpressionBody(position, exprOpt, method.SemicolonToken)
                || IsInBlock(position, method.Body);
        }
开发者ID:tvsonar,项目名称:roslyn,代码行数:16,代码来源:LookupPosition.cs

示例2: IsInMethodDeclaration

        internal static bool IsInMethodDeclaration(int position, BaseMethodDeclarationSyntax methodDecl)
        {
            Debug.Assert(methodDecl != null);

            var body = methodDecl.Body;
            if (body == null)
            {
                return IsBeforeToken(position, methodDecl, methodDecl.SemicolonToken);
            }

            return IsBeforeToken(position, methodDecl, body.CloseBraceToken) ||
                   IsInExpressionBody(position, methodDecl.GetExpressionBodySyntax(), methodDecl.SemicolonToken);
        }
开发者ID:tvsonar,项目名称:roslyn,代码行数:13,代码来源:LookupPosition.cs

示例3: IsInBody

 /// <summary>
 /// A position is inside a body if it is inside the block or expression
 /// body. 
 ///
 /// A position is considered to be inside a block if it is on or after
 /// the open brace and strictly before the close brace. A position is
 /// considered to be inside an expression body if it is on or after
 /// the '=>' and strictly before the semicolon.
 /// </summary>
 internal static bool IsInBody(int position, BaseMethodDeclarationSyntax method)
     => IsInBody(position, method.Body, method.GetExpressionBodySyntax(), method.SemicolonToken);
开发者ID:jkotas,项目名称:roslyn,代码行数:11,代码来源:LookupPosition.cs


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