People. Add(New Person With {. Name = "P1", .
Age = 1, . BDay = Now}) _people. Add(New Person With {.
Name = "P2", . Age = 2, . BDay = Now}) _people.
Add(New Person With {. Name = "P3", . Age = 3, .
BDay = Now}) _people. Add(New Person With {. Name = "P4", .
Age = 4, . BDay = Now}) Dim infos = From x In _people _ Select New With {. AnonName = x.
Name, . AnonAge = x. Age} For Each anon In infos Debug.
Print("anonName=" + anon. AnonName + " anonAge=" + anon.anonAge. ToString) Next.
You need to add Option Infer On before the Imports statements. You may also need Option Strict Off depending on if you use it or not. This allows VB.NET to infer the anonymous type.
While having Option Infer Off would make the For Each line fail, it would also make the Dim Infos = ... line fail, unless Option Strict is also off. – Gideon Engelberth May 3 '10 at 21:47.
Regarding the "Option Infer On" thanks, this took me 2 days to find and hundreds of exmaples of how to do linq queries but no examples on how to USE them, was about to give up on LINQ altogether ;).
I was upgrading from vs 20005 to vs 2008 to vs 2010 the Option Infer Off was turned off, when I turned it on everything worked just fine.. I it is by default turned on on vs 2010 and 2008, but in vs2005 it is not an option! S.
Add(New Person With {. Name = "P1", . Add(New Person With {.
Name = "P2", . Add(New Person With {. Name = "P3", .
Add(New Person With {. Name = "P4", . Select New With {.
AnonName = x.Name, . AnonAge = x. Print("anonName=" + anon.
AnonName + " anonAge=" + anon.anonAge.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.