c# to vb.net convsersion
.net, asp.net, c#, c#-to-vb.net, vb.net
Solution
Remove the `Key`
do this instead:
Dim combinedResults = cars.Select(Function(c) New carTruckCombo() With { _
.ID = c.ID, _
.make = c.make, _
.model = c.model _
}).Union(tracks.Select(Function(t) New carTruckCombo() With { _
.ID = t.ID, _
.make = t.make, _
.model = t.model _
}))
As a side-note, this converter always worked better for me whenever i needed it:
http://converter.telerik.com/
Problem
I am trying to convert a block of c# to vb. I used the service at developerfusion.com to do the conversion, but when I paste it into Visual Studio, it is complaing about the "Key" statements("Name of field or property being initialized in an object initializer must start with '.' "). I played around with the code for a few hours trying to get around that, but everything I did only led to more errors. So I started to wonder if the conversion at developerfusion was ever correct. Here is the c# to vb.net. I am not sure where "Key" is coming from and was wondering if someone could enlighten me. Thanks! From ``` var combinedResults = cars.Select(c=>new carTruckCombo{ID=c.ID,make=c.make,model=c.model}) .Union(tracks.Select(t=>new carTruckCombo{ID=t.ID,make=t.make,model=t.model})); ``` To ``` Dim combinedResults = cars.[Select](Function(c) New carTruckCombo() With { _ Key .ID = c.ID, _ Key .make = c.make, _ Key .model = c.model _ }).Union(tracks.[Select](Function(t) New carTruckCombo() With { _ Key .ID = t.ID, _ Key .make = t.make, _ Key .model = t.model _ })) ```