我使用InvokeRequired来保证线程安全,但是当涉及到我的方法时,如果我将值传递为true,它总是显示我的错误。为什么以及如何解决它?
Public Sub InitGrid(Optional myValue As Boolean = False)
If Me.InvokeRequired Then
Me.Invoke(New MethodInvoker(AddressOf InitGrid))
Else
MsgBox(myValue.ToString()) //always false...
End If
End Sub
答案 0 :(得分:1)
您可以使用Action(of T)版本:
$headers = [
'Api-Key' => $this->apiKey,
];
$client = new Client([
'headers' => $headers,
]);
$res = $client->put("{$this->baseUrl}/members/{$fields['vip_id']}", [
'json' => $fields, // causes Guzzle to set content type to application/json
// and json_encode your $fields
]);