What's a sync method and what is an async method ? What's the difference between sync and async methods ? When do I have to use sync or async method ? I'm asking those questions because I don't understand :
public async void ReadData(filepath)
{
CreateDoc("hello"); //<------ Why I can't do that ?
}
public void CreateDoc(string astring)
{
Debug.WriteLine(astring);
}
And why I can't do that ? :
public async void ReadData(filepath)
{
var BarreDroite = new string[] { "|" };
foreach (string tableArret in items.Split(BarreDroite, StringSplitOptions.RemoveEmptyEntries))
{
listeArret.Add(tableArret); //<---- Here appear the problem.
}
{
I ask this question because I don't really find clear explanations on the web.
See Question&Answers more detail:os