/// <summary> /// Delete the providen key from the server /// </summary> /// <param name="key" /> /// <returns>True when the deletion is effective</returns> public bool Delete(string key) { var taskSource = new TaskCompletionSource <bool>(); if (!_client.Delete( key: key, callback: s => { if (s == Status.NoError) { taskSource.SetResult(true); } else { taskSource.SetResult(false); } })) { taskSource.SetResult(false); } if (taskSource.Task.Wait(_receiveTimeout)) { return(taskSource.Task.Result); } else { return(false); } }
/// <summary> /// Delete the providen key from the server /// </summary> /// <param name="key" /> /// <returns>True when the deletion is effective</returns> public bool Delete(string key) { var taskSource = new TaskCompletionSource <bool>(); if (!_client.Delete(key, s => taskSource.SetResult(s == Status.NoError))) { taskSource.SetResult(false); } if (!taskSource.Task.Wait(_receiveTimeout)) { return(false); } return(taskSource.Task.Result); }