I have the below method calling which returns multiple values and also the function is asynchronous type.
var (averageSalary, numberOfEmployee) = await SomeCalculation(0L, 10, 0L == 10L);
Now I need to write the method signature and return type of the function. Below is the code:
private static void Main(string[] args)
{
var (averageSalary, numberOfEmployee) = await SomeCalculation(0L, 10, 0L == 10L);
}
public static async Task<(long averageSalary, long numberOfEmployee)> SomeCalculation(long num1, long num2, bool b)
{
long averageSalary = num1;
long numberOfEmployee = num2;
return (averageSalary, numberOfEmployee);
}
But the problem is when the method is calling in the main method, the below error is showing.
The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.
Can anyone give me the suggestion to write the correct method signature.