负责现在的这个项目也有一段时间了,但是始终还是习惯不了vb.net的语法
碰到一些漂亮的语法糖,常常写不出来,最终用c#写好再用工具转,但是工具对新语法支持又太差
比如今天折腾了半个小时,写出了下面这样号称有lambda+linq的丑陋代码。此刻我是多么怀念c#~~

Sub CheckMustInput(ByVal lstMessage As List(Of String), _
Optional ByVal container As Control = Nothing)
Dim formCtrl = If(container, Me)
Dim ctrls = From ctr In formCtrl.Controls.Cast(Of Control)() _
Where TypeOf ctr Is UCTextBox Or _
               TypeOf ctr Is GroupBox Or _
               TypeOf ctr Is Panel Or _
               Select ctr
Dim checkInput = Sub(x As Control, y As List(Of String))
'......
End Sub
For Each tmp As Control In ctrls
checkInput(tmp, lstMessage)
Next
End Sub

Back