Debug my C#10 Get function
Budget: $10 – $30 USD
I am trying to write a C#10 Get function and I am not familiar with Tasks. I just need someone to correct my code and make my function callable. I can supply the real endpoint upon hire. Here is what I have:
using System;
using System.Net;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace IexFetch
{
class Program
{
static void Main(string[] args)
{
static async Task<string> Get(string url)
{
var client = new HttpClient();
var result = await client.GetStringAsync(url);
return result;
}
void LetsDoThis()
{
string response = await Get("https://example.com/data");
Console.WriteLine(response);
}
//Call function
LetsDoThis();
}
}
}
using System;
using System.Net;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace IexFetch
{
class Program
{
static void Main(string[] args)
{
static async Task<string> Get(string url)
{
var client = new HttpClient();
var result = await client.GetStringAsync(url);
return result;
}
void LetsDoThis()
{
string response = await Get("https://example.com/data");
Console.WriteLine(response);
}
//Call function
LetsDoThis();
}
}
}