Answer the question
In order to leave comments, you need to log in
How does variable initialization work here?
Good afternoon. I can't understand one thing. In normal compilation mode, the phrase "Constructor B" is printed once. However, if you start debugging in one place (indicated in the code), then the phrase is printed 3 times. Very curious why this is happening.
using System;
class Program
{
static void Main()
{
Console.WriteLine("До вызова");
Class_1.StaticMethod();
Console.WriteLine("После вызова");
Console.ReadKey();
}
}
class Class_1
{
private Class_2 field = new Class_2();
public static void StaticMethod()
{
Console.WriteLine(new Class_1().field); // Флажок для отладки
}
}
class Class_2
{
public Class_2()
{
Console.WriteLine("Конструктор B");
}
public override string ToString()
{
return "Class_2";
}
}
Answer the question
In order to leave comments, you need to log in
1. Fetch works. Server side error. Check the server and learn how to work with the network tab in the developer panel.
2. In the variant with Fetch in the body, in your case, you need to pass URLSearchParams
const body = new URLSearchParams();
body.set('key', 'value');
fetch(url, {
method: 'POST',
headers: {
'Accept': 'application/x-www-form-urlencoded;charset=UTF-8'
},
body,
}).then(...);
'x-www-form-urlencoded'
shouldn't be any.Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question