vb.net get代码, 如果改进foxtable中, 还有post方法应该如何写?
Imports System.Net.Http
Imports System.Threading.Tasks
Public Class WebApiClient
Private Shared ReadOnly _client As New HttpClient()
Public Shared Async Function GetDataAsync(ByVal uri As String) As Task(Of String)
Try
Dim response As HttpResponseMessage = Await _client.GetAsync(uri)
If response.IsSuccessStatusCode Then
Dim content As String = Await response.Content.ReadAsStringAsync()
Return content
Else
Return Nothing
End If
Catch ex As Exception
' 处理异常
Return Nothing
End Try
End Function
End Class