Async Concepts
Awaited Result
Treat an awaited operation as a value that becomes available later.
Awaited Result
AwaitedResult.cs
using System;
class Program
{
static int FetchScore(int storedScore)
{
return storedScore;
}
static void Main()
{
int storedScore = ;
int score = FetchScore(storedScore);
string result = score >= 60 ? "pass" : "retry";
Console.WriteLine($"score={score}");
Console.WriteLine($"result={result}");
}
}
using System;
class Program
{
static int FetchScore(int storedScore)
{
return storedScore;
}
static void Main()
{
int storedScore = ;
int score = FetchScore(storedScore);
string result = score >= 60 ? "pass" : "retry";
Console.WriteLine($"score={score}");
Console.WriteLine($"result={result}");
}
}
using System;
class Program
{
static int FetchScore(int storedScore)
{
return storedScore;
}
static void Main()
{
int storedScore = ;
int score = FetchScore(storedScore);
string result = score >= 60 ? "pass" : "retry";
Console.WriteLine($"score={score}");
Console.WriteLine($"result={result}");
}
}
async
After an awaited operation completes, the rest of the method can use the returned value like any other local variable.