using System.Threading.Tasks;
public static void Main()
var x = CheckIfFieldExists("", "username");
public async static Task<string> CallbackFunction()
Console.WriteLine("Before Task.Delay");
Console.WriteLine("After Task.Delay - returning");
private static bool CheckIfFieldExists(string toSearch, string type) {
bool doesFieldExist = false;
if (type == "username") {
Task t = CallbackFunction().ContinueWith(task => {
Console.WriteLine("Task was faulted: Pulling from database");
else if (task.IsCompleted) {
string snap = task.Result;
if (snap == "Photograph") {
Console.WriteLine("field exists");
Console.WriteLine("field doesnt exist");
TimeSpan ts = TimeSpan.FromMilliseconds(1000);
Console.WriteLine("returning field status");