R
RobinS
I can do this in VB:
For Each fld As Field In _
fieldList.FindAll(AddressOf SearchSelOrKeyNotID)
'do stuff here
Next
where the function is defined:
Private Shared Function _
SearchSelOrKeyNotID(ByVal f As Field) As Boolean
Return Not f.IsIdentity _
AndAlso (f.IsSelected OrElse f.IsKey)
End Function
And fieldList is defined:
Dim fieldList As List(Of Field)
In C#, I can do this with an anonymous method like this (which is cool):
foreach (Field fld in fieldList.FindAll(
delegate(Field f)
{
return (Not f.IsIdentity && (f.IsSelected || f.IsKey));
}))
{
//do stuff
}
where fieldList is defined as:
List<Field> fieldList;
However, I want to use this repeatedly, so I want to know how to use a
function, the way I do in VB. I would appreciate any help you can give me.
(And I hope I got all those pesky curly braces and semi-colons right.)
Thanks in advance,
Robin S.
For Each fld As Field In _
fieldList.FindAll(AddressOf SearchSelOrKeyNotID)
'do stuff here
Next
where the function is defined:
Private Shared Function _
SearchSelOrKeyNotID(ByVal f As Field) As Boolean
Return Not f.IsIdentity _
AndAlso (f.IsSelected OrElse f.IsKey)
End Function
And fieldList is defined:
Dim fieldList As List(Of Field)
In C#, I can do this with an anonymous method like this (which is cool):
foreach (Field fld in fieldList.FindAll(
delegate(Field f)
{
return (Not f.IsIdentity && (f.IsSelected || f.IsKey));
}))
{
//do stuff
}
where fieldList is defined as:
List<Field> fieldList;
However, I want to use this repeatedly, so I want to know how to use a
function, the way I do in VB. I would appreciate any help you can give me.
(And I hope I got all those pesky curly braces and semi-colons right.)
Thanks in advance,
Robin S.