Question pb using linq and anonymous types

Mab CV

New member
Joined
Jun 29, 2009
Messages
2
Programming Experience
5-10
Hi,

I have a problem using linq and anonymous types in an asp.net vb.net application.
When I write the code above, I have 2 errors :
- "declarations of variable with Option Strinct On requires an As clause"
- "the name 'item' is not declared"

VB.NET:
Public Sub MyFunc(ByVal xe As System.Xml.Linq.XElement)
Dim lstitems = From it In xe.Elements Select txt = it.@Text, value = it.@Value
            For Each item In lstitems
                Dim s As String = item.txt
            Next
End Sub
Does it mean that is not possible to use Option Strict On and Option Explicit On ?
Or I make a syntax error ?
Or is it just a bad configuration of my application ?

Thanks for your answsers
Regards
Mab
 
Turn on Option Infer.
 
Back
Top