Giter Site home page Giter Site logo

Missing () about csharptovb HOT 5 CLOSED

VBAndCs avatar VBAndCs commented on August 26, 2024
Missing ()

from csharptovb.

Comments (5)

paul1956 avatar paul1956 commented on August 26, 2024

@VBAndCs Need a more complete example, from the snippit I don't know PageFactory is a property.

from csharptovb.

paul1956 avatar paul1956 commented on August 26, 2024

@VBAndCs can you provide any open source file with this issue.

from csharptovb.

VBAndCs avatar VBAndCs commented on August 26, 2024

You can create any property of type Func<T> and test it. Here is a sample:

using System;

namespace ConsoleAppCs
{
    class Program
    {

       static Func<int> Foo { get; } = () => 3;
        static void Main(string[] args)
        {
            var y = Foo();
            Console.WriteLine("Hello World!");
        }
    }
}

Resulted VB:

Option Explicit On
Option Strict On
Imports System

Namespace ConsoleAppCs
    Class Program

        Private Shared ReadOnly Property Foo As Func(Of Integer) = Function() 3
        Private Shared Sub Main(args As String())
            Dim y As Integer = Foo()
            Console.WriteLine("Hello World!")
        End Sub
    End Class
End Namespace

in VB code, Y should be a Func(of Integer) and you will get an error because you defined it as Integer. It is an Integer in C#, because it gets the result of calling the Func. So, you must add () in VB:
Dim y As Integer = Foo()()

from csharptovb.

VBAndCs avatar VBAndCs commented on August 26, 2024

As I said: C# properties don't have argument lists, so, when you see ([params]) after a property in C#, add empty () before it in VB.

from csharptovb.

paul1956 avatar paul1956 commented on August 26, 2024

@VBAndCs I have fixed this case using brute force, not sure I can always identify cases I need to do this with the information I have.
Trial fix in 4.3.0.3 Converter 3.3.0.3.

from csharptovb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.