I am programming a C# blazor game, and there is a method that sets a property in a class. If the button, which calls the method was clicked, on the next page the property will be printed.
Here is a simplified example:
So the problem is. if the method will be called the initialising process of the game isnt finished, and the property is still null.
How can I await the method so that the property will be printed?
Here is a simplified example:
C#:
class A{
public string test {get; set;}
}
class B{
public void StartGame()
{
//start game
//here is a string word
A a = new A();
a.test = word;
}
}
//html
<div>
@a.test
</div>
So the problem is. if the method will be called the initialising process of the game isnt finished, and the property is still null.
How can I await the method so that the property will be printed?