Projeto.cs
public class Projeto
{
public string Nome { get; set; }
private List<string> tarefas;
public Projeto(string nome)
{
this.Nome = nome;
tarefas = new List<string>();
}
public void AdicionarTarefa(string tarefa)
{
tarefas.Add(tarefa);
}
public void ExibirTarefas()
{
Console.WriteLine("Projeto: " + Nome);
Console.WriteLine("Tarefas:");
foreach (string tarefa in tarefas)
{
Console.WriteLine("- " + tarefa);
}
Console.WriteLine("Total: " + QuantidadeTarefas + " tarefas");
}
public int QuantidadeTarefas
{
get { return tarefas.Count; }
}
}
Program.cs
Projeto projeto = new Projeto("Sistema de Inventário");
projeto.AdicionarTarefa("Criar tela de login");
projeto.AdicionarTarefa("Implementar banco de dados");
projeto.AdicionarTarefa("Teste");
projeto.ExibirTarefas();