List creation conversion error

2 posts, 0 answers
  1. Gareth
    Gareth avatar
    2 posts
    Member since:
    May 2009

    Posted 01 Jul 2011 Link to this post

    Hi,

    According to the convertor:
    C#
    private static IQueryable<product> fake = new List<product> {
    new product { name = "test", Price = 25 },
    new product { name = "test", Price = 25 }}.AsQueryable();

    Converts to:VB.NET
    Private Shared fake As IQueryable(Of product) = New List(Of product)() With { _
        New product() With { _
            .name = "test", _
            .Price = 25 _
        }, _
        New product() With { _
            .name = "test", _
            .Price = 25 _
        } _
    }.AsQueryable()

    But that gives errors in Visual Studio. As far as I can tell it should be:
    Private Shared fake As IQueryable(Of product) = New List(Of product) From{ _
    New product() With { _
    .name = "test", _
    .Price = 25 _
    }, _
    New product() With { _
    .name = "test", _
    .Price = 25 _
    } _
    }.AsQueryable()

    Thanks

    Gareth
  2. Todd
    Admin
    Todd avatar
    66 posts

    Posted 01 Jul 2011 Link to this post

    Hi Gareth,

    Thanks for the report! We'll investigate the NRefactory engine (which powers the language conversions today) and see if updates are available that can address this scenario.

    Hopefully we'll be able to fix this problem with a new version of NRefactory.

    Thanks!
    -Todd

Back to Top