Exemplo n.º 1
0
        public override string ToString()
        {
            string result = $"Id:{Id} Created:{CreatedAt.ToShortDateString()}\nName:{Name}\nEmail:{Email}\nAddress:{MyAddress}\n";

            if (Todos != null && Todos.Count() > 0)
            {
                result += "\tToDos list:\n";
                foreach (var item in Todos)
                {
                    result += item.ToString();
                }
                result += "\n";
            }
            if (Posts != null && Posts.Count() > 0)
            {
                result += "\tPosts list:\n";
                foreach (var item in Posts)
                {
                    result += item.ToString();
                }
                result += "\n";
            }
            if (Comments != null && Comments.Count() > 0)
            {
                result += "\tComments list:\n";
                foreach (var item in Comments)
                {
                    result += item.ToString();
                }
                result += "\n";
            }
            return(result);
        }