Using call outside method
using (var wc = new System.Net.WebClient())
{
string contents = wc.DownloadString("some-site-with-data.com/file.txt");
string int_to_string = randomly_int(1, 100).ToString();
contents = contents + int_to_string;
WriteFile(contents);
}
private static void WriteFile(string data)
{
string path = System.IO.Directory.GetCurrentDirectory() + "\\log.txt";
System.IO.File.WriteAllText(path,data);
}
private static int randomly_int(int first, int second)
{
System.Random rnd = new Random();
int new_int = rnd.Next(first, second);
return new_int;
}
Last updated