Answer the question
In order to leave comments, you need to log in
How to pass the value of a local variable to a global one?
Hello.
In general there is a code
static void Main(string[] args)
{
string url = "ссылка";
using (var webClient = new WebClient())
{
var response = webClient.DownloadString(url);
string srt = "dasda";
if (response.Contains("RTF_WRM=") == true)
{
Regex regex = new Regex(@"R\d{12}");
MatchCollection matches = regex.Matches(response);
if (matches.Count > 0)
{
foreach (Match match in matches)
{
Console.WriteLine(match.Value);
srt = match.Value;
}
}
}
}
}
Answer the question
In order to leave comments, you need to log in
1 - there are no global variables in the sharp
2 - if "another lane" is also on the sharp, but in another project, well, call it with parameters, what's the problem? <project_name>.Main(new string[] { param0, param1, ....}); only in the main project you need to add a link to the secondary
3 - or run as an external process, and form a line of call parameters, an example is here
I am not very strong in C#, I want to learn.
I wanted to download that I have static void Main(string[] args) and static void Main1(string[] args)
So how do I make static void Main(string[] args) see the variable from static void Main1(string [] args) - srt = match.Value;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question