public static ExpressionSyntax VbCoerceToString(ExpressionSyntax csNode, TypeInfo typeInfo)
 {
     return(typeInfo.Type?.SpecialType switch
     {
         SpecialType.System_String => csNode,
         SpecialType.System_Char => SyntaxFactory.InvocationExpression(ValidSyntaxFactory.MemberAccess(csNode, nameof(ToString))),
         _ => NewStringFromArg(csNode)
     });
Exemple #2
0
        private async Task <ExpressionSyntax> ConvertToLikeOperatorAsync(VBSyntax.BinaryExpressionSyntax node, KnownMethod member)
        {
            var(lhs, rhs) = await AcceptSidesAsync(node);

            var compareText = ValidSyntaxFactory.MemberAccess("CompareMethod", _visualBasicEqualityComparison.OptionCompareTextCaseInsensitive ? "Text" : "Binary");

            _visualBasicEqualityComparison.ExtraUsingDirectives.Add("Microsoft.VisualBasic");
            return(member.Invoke(_visualBasicEqualityComparison.ExtraUsingDirectives, lhs, rhs, compareText));
        }