private void btnDelete_Click(object sender, EventArgs e) { try { var kvGovern = new KVGovern(); var result = kvGovern.DeleteKey(new DeleteKeyParmeter { Key = txbKey.Text }); txbKey.Clear(); txbValue.Clear(); LoadConfig(); if (result) { MessageBox.Show("删除成功!"); txbKey.Clear(); txbValue.Clear(); LoadConfig(); } else { MessageBox.Show("删除失败!"); } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
/// <summary> /// Delete Key /// </summary> private static void DeleteKey() { var kvGovern = new KVGovern(); var result = kvGovern.DeleteKey(new DeleteKeyParmeter { Key = "testkey" }).GetAwaiter().GetResult(); Console.WriteLine(EntityToString(result)); }