Please have a look at the code below.
Dim results As IEnumerable(Of Customer) = ExecuteDataReader( _
"SELECT * FROM Customer WHERE Sales> @MinSales", _
Sub(p) p.Add("@MinSales", SqlDbType.Double).Value = 10000.0, _
Function(r) New Customer() With {Name=r("Name"), Address=r("Address"), Sales=r("Sales") })
For Each c As Customer in results
'...
Next
In a previous question I posted, the answerer posted this code. I do not understand the sub(p) or function(r) part of the code.
Unfortunately I have no basis to search for an answer to this. Therefore I have posted this question after completing a limited amount of research.
What is meant by sub(p) and function(r) ?
Update 14:54
Please see below. What is meant by: (Of T) and ByVal castRow As Function(Of IDataRecord, T)?
Public Iterator Function ExecuteDataReader(Of T)(ByVal sql As String,
ByVal addParams as Action(Of SqlParameterCollection), ByVal castRow As
Funnction(Of IDataRecord, T)) As IEnumerable(Of T)
Lambda Expressions: