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?

1
  • It sounds like Foo isn't storing the values of the parameters to the constructor. Can you post the constructor as well? Commented May 3, 2012 at 15:09

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.