I am trying to initialize a list of type Movie in class other than Movie while both the classes are in the same namespace. Code is mentioned underneath:
namespace MovieListCaseStudy
{
class Movie
{
private int id;
public int Id
{
get { return id; }
set { id = value; }
}
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
private float duration;
public float Duration
{
get { return duration; }
set { duration = value; }
}
private float price;
public float Price
{
get { return price; }
set { price = value; }
}
}
}
******
namespace MovieListCaseStudy
{
class BusinessLogic
{
List<Movie> movielist = new List<Movie>();
{
{Id=1, Name="pk", Duration=2, Price=200}
};
}
}
the problem is that Id, Name etc. attributes are not being identified in the BusinessLogic class. Kindly help.
public TimeSpan Duration {get;set;}and price (as all money related values) should bepublic decimal Price {get;set;}.