Private Sub ChangeCursor(ByVal target As FrameworkElement, ByVal cursor As Cursor)
target.Dispatcher.Invoke(DispatcherPriority.Normal,
New DispatcherOperationCallback( _
Function()
Mouse.OverrideCursor = cursor
Return Nothing
End Function),
Nothing)
End Sub
和
Private Sub ChangeCursor(ByVal target As FrameworkElement, ByRef cursor As Cursor)
target.Dispatcher.Invoke(DispatcherPriority.Normal,
New DispatcherOperationCallback( _
Function(cursor1 as Cursor)
Mouse.OverrideCursor = cursor1
Return Nothing
End Function),
cursor)
End Sub
答案 0 :(得分:1)
第二个片段可能更便宜。 lambda不必捕获游标参数的值。它们在功能上是相同的。尽量不要让小东西出汗。
答案 1 :(得分:0)
“在功能上”你的意思是“就他们做什么而言”?如果是这样,那么我必须说是。