I have two classes defined as follows.
First one:
internal class Content {
internal Content(Master master) {
// code omitted
}
// code omitted
}
second one:
public class Master {
internal Content content { get; set; }
internal Master() {
// code omitted
}
// code omitted
}
Exposing the Content Class as property of the Master I need to do something like this:
Master M = new Master();
M.content = new Content(M);
Is there a way to do not pass the Master (M) in the Content Consctructor?
Presumably
Contentneeds aMaster? Actually, constructors are a fairly good way of managing this, but if that is a problem, you could also do something like:or have
Mastercreate theContentby default. Frankly, though, I’d leave it “as is” until there is an actual “this is a problem”.