简体   繁体   中英

c#.net to vb.net: List(of …) .find

Can someone please translate the following C#.NET to VB.NET for me, as I'm really confused, and google isn't much help. Normally I would just do a for each loop.

Public void removeEval(string id)
{
    evals.Remove(evals.Find(e => e.Id.Equals(id)));
}

I got the code from http://channel9.msdn.com/shows/Endpoint/Endpoint-Screencasts-Creating-Your-First-WCF-Service/ and I'm trying to make sense of it in VB.NET.

那是一个lambda表达式

evals.Remove(evals.Find(Function(e) e.Id.Equals(id)))

google gave me this http://www.developerfusion.com/tools/convert/csharp-to-vb/

which translates this function to:

Public Sub removeEval(id As String)
    evals.Remove(evals.Find(Function(e) e.Id.Equals(id)))
End Sub

after I corrected this: evals.Find(e => e.Id.Equals(id)));

 Public Sub RemoveEvals(ByVal id As String)
       evals.Remove(evals.Find(Function(e) e.Id.Equals(id)))
 End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM