I am trying to create a simple object-oriented program for a fictional movie theatre. Therefore I am making a kind of list with all the movies. My issue is that I can not add genres to my genre array in the child classes to the Movies class.
Here is what I have made so far.
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BentesBio
{
class Program
{
static void Main(string[] args)
{
Movie[] moviesArray = new Movie[6];
moviesArray[0] = new FeatureFilm { Director = "", Country = "", Budget = 0.0, BudgetCurrency = "", BudgetDKK = 0.0, Year = 0000, Score = "", Length = 00, Genre = { "", "" }, Cast = {} };
moviesArray[1] = new FeatureFilm { Director = "", Country = "", Budget = 0.0, BudgetCurrency = "", BudgetDKK = 0.0, Year = 0000, Score = "", Length = 00 };
moviesArray[2] = new FeatureFilm { Director = "", Country = "", Budget = 0.0, BudgetCurrency = "", BudgetDKK = 0.0, Year = 0000, Score = "", Length = 00 };
moviesArray[3] = new FeatureFilm { Director = "", Country = "", Budget = 0.0, BudgetCurrency = "", BudgetDKK = 0.0, Year = 0000, Score = "", Length = 00 };
moviesArray[4] = new Documentary { Director = "", Country = "", Budget = 0.0, BudgetCurrency = "", BudgetDKK = 0.0, Year = 0000, Score = "", Length = 00, Theme = { "", "" } };
moviesArray[5] = new Documentary { Director = "", Country = "", Budget = 0.0, BudgetCurrency = "", BudgetDKK = 0.0, Year = 0000, Score = "", Length = 00 };
Console.ReadKey();
}
}
class Movie
{
public string Director { get; set; }
public string Country { get; set; }
public double Budget { get; set; }
public string BudgetCurrency { get; set; }
public double BudgetDKK { get; set; }
public int Year { get; set; }
public string Score { get; set; }
public int Length { get; set; }
}
class FeatureFilm : Movie
{
public string[] Genre { get; set; }
public string[] Cast { get; set; }
}
class Documentary : Movie
{
public string[] Theme { get; set; }
}
}
Any suggestions would be much appreciated.
List<T>instead arrays (T[]) ... arrays are hard to expand (you need to create bigger and copy elements from old one)