using System.Threading.Tasks;
public static void Main()
var val = Task.Run(async () => {
var calls = new asyncmethods();
return await calls.BuildDetails("TheName", 34, default);
Console.WriteLine(val.Age);
public class asyncmethods
public async Task<IDetails> BuildDetails (string name, int age, CancellationToken cancellationToken) {
return new Details(name) {
public string Name { get; private set; }
public int Age { get; set; }
public Details (string name) {
public interface IDetails