0

I have a query that 'selects' object of a type:

Dim l as IList(Of Foo) = (From dataRow As DataRow In table.Select()
                          Where CStr(dataRow("Column1")) = "A"
                          Select New Foo(CStr(dataRow("Column1")), _
                                         CStr(dataRow("Column2")))).ToList()

What's happening is that if i set a break-point to the constructor of Foo and step, the constructor is hit and the parameters are loaded with the arguments. However, l has empty Foo objects (the members in every object are Nothing). What could be happening here?

pylover
  • 7,670
  • 8
  • 51
  • 73
badmaash
  • 4,775
  • 7
  • 46
  • 61
  • It sounds like `Foo` isn't storing the values of the parameters to the constructor. Can you post the constructor as well? – davisoa May 03 '12 at 15:09

1 Answers1

1

Change your query to :

Dim l as IList(Of Foo) = (From dataRow As DataRow In table..AsEnumerable()
                          Where datarow.Field(of String)("Column1") = "A" 
                          Select New Foo(datarow.Field(of String)("Column1"), _
                                         datarow.Field(of String)("Column1"))).ToList()

for more informations you can visit here and here

pylover
  • 7,670
  • 8
  • 51
  • 73