Example #1
0
        private static SyntaxNode Unwrap(ISyntaxFactsService syntaxFacts, SyntaxNode node)
        {
            var invocation = node as TInvocationExpression;

            if (invocation != null)
            {
                return(syntaxFacts.GetExpressionOfInvocationExpression(invocation));
            }

            var memberAccess = node as TMemberAccessExpression;

            if (memberAccess != null)
            {
                return(syntaxFacts.GetExpressionOfMemberAccessExpression(memberAccess));
            }

            var conditionalAccess = node as TConditionalAccessExpression;

            if (conditionalAccess != null)
            {
                return(syntaxFacts.GetExpressionOfConditionalAccessExpression(conditionalAccess));
            }

            var elementAccess = node as TElementAccessExpression;

            if (elementAccess != null)
            {
                return(syntaxFacts.GetExpressionOfElementAccessExpression(elementAccess));
            }

            return(null);
        }
        private static SyntaxNode Unwrap(ISyntaxFactsService syntaxFacts, SyntaxNode node)
        {
            if (node is TInvocationExpression invocation)
            {
                return(syntaxFacts.GetExpressionOfInvocationExpression(invocation));
            }

            if (node is TMemberAccessExpression memberAccess)
            {
                return(syntaxFacts.GetExpressionOfMemberAccessExpression(memberAccess));
            }

            if (node is TConditionalAccessExpression conditionalAccess)
            {
                return(syntaxFacts.GetExpressionOfConditionalAccessExpression(conditionalAccess));
            }

            if (node is TElementAccessExpression elementAccess)
            {
                return(syntaxFacts.GetExpressionOfElementAccessExpression(elementAccess));
            }

            return(null);
        }