本文整理汇总了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);
}
示例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);
}
示例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);