Skip to content

VB -> C#: Collection Initializers/Collection Expressions #1211

Description

@wfrx

VB.Net input code

Public Sub MyMethod(params As Key())

MyMethod({ "foo", "bar", "baz" })

Erroneous output

MyMethod(new[] { "foo", "bar", "baz" })

Expected output

MyMethod(new Key[] { "foo", "bar", "baz" })
//or
MyMethod(["foo", "bar", "baz"])

Details

  • Product in use: codeconv 10.0

It probably has to do with our own Key Class that C# then interprets as strings.
Collections of other classes (e.g. Integers, other more complex classes) work fine with new[] { 1, 2, 3 }
I don't know if this is something the converter should (could) be able to handle, as it looks like a problem particular to our codebase.
If not, it's a candidate for custom pre/post-processing we need to implement ourselves.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    VB -> C#Specific to VB -> C# conversion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions