public static void Main() { ContinentFactory[] continentFactories = new ContinentFactory[] { new AfricaFactory(), new AmericaFactory() }; Console.WriteLine(string.Join <ContinentFactory>($"{Environment.NewLine}{Environment.NewLine}", continentFactories)); }
// Entry point into console application. public static void Main() { // Create and run the African animal world continent = new AfricaFactory(); fauna = new AnimalWorld(continent); fauna.RunFoodChain(); // Create and run the American animal world continent = new AmericaFactory(); fauna = new AnimalWorld(continent); fauna.RunFoodChain(); // Wait for user input Console.ReadKey(); }
// Constructor public AnimalWorld(ContinentFactory factory) { _carnivore = factory.CreateCarnivore(); _herbivore = factory.CreateHerbivore(); }
//constructor public AnimalWorld(ContinentFactory factory) { _abstractHerbivore = factory.CreateHerbivore(); _abstractCarnivore = factory.CreateCarnivore(); }
internal AnimalWorld(ContinentFactory factory) { _herbivorus = factory.CreateHerbivorus(); _carnivorus = factory.CreateCarnivorus(); }
public AnimalWorld(ContinentFactory continentFactory) { this._carnivore = continentFactory.CreateCarnivore(); this._herbivore = continentFactory.CreateHerbivore(); }
// Constructor. public AnimalWorld(ContinentFactory factory) { this.carnivore = factory.CreateCarnivore(); this.herbivore = factory.CreateHerbivore(); }
public AnimalWorld(ContinentFactory continent) { _herbivore = continent.CreateHerbivore(); _carnivore = continent.CreateCarnivore(); }
// Constructor public AnimalWorld(ContinentFactory factory) { // Here another factory is deciding who is Hunter and who is victim _Hunter = factory.CreateHunter(); _Victim = factory.CreateVictim(); }
private Carnivore _carnivore; // создаем переменную типа ХИЩНИК // Constructor public AnimalWorld(ContinentFactory factory) { _carnivore = factory.CreateCarnivore(); // идем на завод и создаем хищника _herbivore = factory.CreateHerbivore(); // идем на завод и создаем травоядное }
// Constructor public AnimalWorld(ContinentFactory factory) { m_carnivore = factory.CreateCarnivore(); m_herbivore = factory.CreateHerbivore(); }
public static void Main() { try { var client = new MongoClient("mongodb://localhost:27017"); var db = client.GetDatabase("local"); var coll = db.GetCollection <BsonDocument>("Animal"); var reader = new StreamReader("animal.csv"); var csv = new CsvReader(reader); csv.Configuration.HasHeaderRecord = true; var records = csv.GetRecords <Animals>(); var dizionario = new Dictionary <string, Animal>(); foreach (var animal in records) { if (dizionario.ContainsKey(animal.Continent)) { dizionario[animal.Continent].Carnivor.Add(animal.Carnivor); dizionario[animal.Continent].Herbivor.Add(animal.Herbivor); } else { var newanimal = new Animal { Continent = animal.Continent, Carnivor = new List <string>(), Herbivor = new List <string>() }; newanimal.Carnivor.Add(animal.Carnivor); newanimal.Herbivor.Add(animal.Herbivor); dizionario.Add(newanimal.Continent, newanimal); } } } catch (Exception err) { Console.WriteLine("Error!!"); Console.WriteLine(err.Message); } Console.ReadKey(); //Console.Read(); var continentFactory = ContinentFactory.Get(ContinentType.AMERICA); var carnivore = continentFactory.GetCarnivore(); var herbivore = continentFactory.GetHerbivore(); foreach (var h in herbivore) { Console.WriteLine(h); } foreach (var c in carnivore) { Console.WriteLine(c); } Console.ReadKey(); }
public Animals(ContinentFactory continentFactory) { _herbivore = continentFactory.CreateHerbivore(); _carnivore = continentFactory.CreateCarnivore(); }
public AnimalWorld(ContinentFactory factory) { _herbivorse = factory.CreateHerbivores(); _carnivorse = factory.CreateCarnivores(); }