private void button1_Click(object sender, EventArgs e)
{
request;
}
Это ошибка, которую я получаю:
Error CS0201 Entrance, Call, Increase, Decrease, and New Object Expression can only be used as statements.
Как я могу вызвать метод запроса и исправить это?
private void request(object sender, EventArgs e)
{
var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://crest-safe.azurewebsites.net/users/checkpayment/vouchers?token=mainBackup&apiKey=pds3583e");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = JsonConvert.SerializeObject(new User("cultureLand", pin));
streamWriter.Write(json);
}
}