This is a migrated thread and some comments may be shown as answers.

Anonymous Types conversion

1 Answer 44 Views
Code Converter
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brian Mains
Top achievements
Rank 1
Brian Mains asked on 23 Dec 2009, 02:01 PM
Hello,

The code converter does not convert anonymous types well from  C# to VB.  Consider this:

var types = new[]
{
    new A { Key= 1, Name = 2 },
    new A { Key= 1, Name = 2 },
    new A { Key= 1, Name = 2 }
}

Does VB have an anonymous collection feature?  I don't think it does, so I always convert to:

Dim types As New List<A>()
types.Add(New A With { .Key = 1, .Name = 2});
.
.

But your code converter just does:

new A()
new A()

Something like that... I was hoping it would at least convert \

new A { Key= 1, Name = 2 },

to

New A With { .Key = 1, .Name = 2}

I understand if it doesn't create a list, but if it could convert the anonymous types correctly, that would help a lot.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Todd
Telerik team
answered on 04 Jan 2010, 04:09 PM
Hello Brian,

Thanks for the feedback. It does seem that NRefactory should support this, so we'll try to update our engine soon. In the mean time, you can try your conversion here to see what NRefactory produces:

http://codeconverter.sharpdevelop.net

Hope that helps.

-Todd
Tags
Code Converter
Asked by
Brian Mains
Top achievements
Rank 1
Answers by
Todd
Telerik team
Share this question
or