コード例 #1
0
        // Get tasks from the database and print the formatted in the console.
        private void ListTasks(DatabaseTools dbTools)
        {
            // Call databasetools to fetch data from the database.
            List <Task> tasks = dbTools.GetAllTasks();

            // Print a line for readability of tasks in the console.
            Console.WriteLine(new String('-', 25));

            // Iterate over tasks from the database and print them.
            foreach (var task in tasks)
            {
                Console.WriteLine(string.Format("{0} '{1}': '{2}'", task.Done ? "X" : " ", task.Name, task.Description));
            }
        }