return 10;
}
private static async Task<int> AsyncMethod(int id) {
int res = await AsyncRequest(); // What's going on from here?
res *= id;
return res;
}
static void Main(string[] args) {
Parallel.For(0, 10, i => {
Console.WriteLine(string.Format("Requesting number from {0}", i));
int Res = Task.Run(async () => await AsyncMethod(i)).Result;
Console.WriteLine(string.Format("Requested number: {0}. From: {1}", Res, i));
});
Console.Read();
}
// What's going on from here?
Обсуждают сегодня