public override string ToString()
        {
            StringBuilder result = new StringBuilder();

            result.AppendLine(this.Name.ToString());

            result.AppendLine("Company:");
            if (this.Company != null)
            {
                result.AppendLine(this.Company.ToString());
            }

            result.AppendLine("Car:");
            if (this.Car != null)
            {
                result.AppendLine(this.Car.ToString());
            }

            result.AppendLine("Pokemon:");

            if (Pokemons.Any())
            {
                result.AppendLine(string.Join(Environment.NewLine, Pokemons));
            }
            result.AppendLine("Parents:");

            if (Parents.Any())
            {
                result.AppendLine(string.Join(Environment.NewLine, Parents));
            }

            result.AppendLine("Children:");

            if (Children.Any())
            {
                result.AppendLine(string.Join(Environment.NewLine, Children));
            }

            return(result.ToString().TrimEnd());
        }
Ejemplo n.º 2
0
 public bool IsAnyPokemonAlive() => Pokemons.Any(p => p.HPCurrent > 0);