【问题标题】:How to store data in a memory list, using List class, in C#?如何在 C# 中使用 List 类将数据存储在内存列表中?
【发布时间】:2022-06-14 09:08:46
【问题描述】:

我需要查询、管理和删除name、cpf和address中输入的数据,我的老师说必须在内存中存储一​​个列表(使用Class List),我该如何使用c#中的列表类?如果我知道如何存储数据,我想我可以完成剩下的工作。

    double CPF;
    string nome, end;

    private void txtNome_TextChanged(object sender, EventArgs e)
    {
        nome = Convert.ToString(txtNome.Text);
    }

    private void txtCPF_TextChanged(object sender, EventArgs e)
    {
        CPF = Convert.ToDouble(txtCPF.Text);
    }

    private void btnCadastra_Click(object sender, EventArgs e)
    {
        if (txtNome.Text == "")
            MessageBox.Show("Complete o nome", "Mensagem do sistema",
                MessageBoxButtons.OK, MessageBoxIcon.Warning);
        if (txtCPF.Text == "")
            MessageBox.Show("Complete o CPF", "Mensagem do sistema",
                MessageBoxButtons.OK, MessageBoxIcon.Warning);
        if (txtEnd.Text == "")
            MessageBox.Show("Complete o endereço", "Mensagem do sistema",
                MessageBoxButtons.OK, MessageBoxIcon.Warning);
        else
            MessageBox.Show("Você foi cadastrada com sucesso", "Mensagem do sistema",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
    }

    private void txtEnd_TextChanged(object sender, EventArgs e)
    {
        end = Convert.ToString(txtEnd.Text);
    }
}

enter image description here

【问题讨论】:

  • 查一下:List<T> class。 VS 有一个帮助菜单,就像 Windows 应用程序几十年来一样,上下文相关的帮助通过 F1 键工作,就像它几十年来一样。
  • 首先你需要一个具有 3 个属性(或字段)的类。

标签: c# list class


猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-10-31
  • 2011-05-04
  • 2011-04-07
  • 2017-04-04
  • 1970-01-01
  • 2021-09-21
相关资源
最近更新 更多