Exemplo n.º 1
0
            private bool IsInvocationWithDynamicArguments(SimpleNameSyntax originalSimpleName, SemanticModel semanticModel)
            {
                var invocationExpression = originalSimpleName.Ancestors().OfType <InvocationExpressionSyntax>().FirstOrDefault();

                // Check to see if this is the invocation Expression we wanted to work with
                if (invocationExpression != null && invocationExpression.Expression.GetLastToken() == originalSimpleName.GetLastToken())
                {
                    if (invocationExpression.ArgumentList != null)
                    {
                        foreach (var argument in invocationExpression.ArgumentList.Arguments)
                        {
                            if (argument != null && argument.Expression != null)
                            {
                                var typeinfo = semanticModel.GetTypeInfo(argument.Expression);
                                if (typeinfo.Type != null && typeinfo.Type.TypeKind == TypeKind.Dynamic)
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }

                return(false);
            }