I am sure i am doing something terribly wrong, but i should better ask the experts.
At the third line i get the error Value of type <anonymous type> cannot be converted to <anonymous type>
Dim Query = (From c In Db.web Select New With {.AA = c.AA}).ToList
Dim v = New With {.Amount = 108}
Query.Add(v)
What am i missing here?
Because you have named your fields differently (and maybe it has different type as well, I don’t know, cause I don’t know what type
c.AAis), compiler has created different type forv, so you have 2 anonymous classes, with different fields (even if they have same type, but their name differs) and they are not compatible with each other.I don’t know VB.Net well, but something like this:
Dim Query = (From c In Db.web Select New With {.Amount = CInt(c.AA)}).ToList Dim v = New With {.Amount = 108} Query.Add(v)Should solve the problem, at least works in
C#.