Sometimes I use some indirect properties to set or get some other sub-properties,
I give an example
class Page
{
public string MainText
{ set { MainParagraph.Text = value; } get { return MainParagraph.Text; }}
public TextBlock MainParagraph {set; get;}
public TextBlock FootNotes {set; get;}
}
class TextBlock
{
public String Text {set; get;}
public bool RightToLeft {set; get;}
}
Without the MainText
property of the Page
I have to use myPage.MainParagraph.Text = something
and now I use myPage.MainText = something
, however one may still use the first alternative. (Should I prevent it?)
Please note Text
is not a real property of Page
and in this way it may represent some sub-properties but not all of them. Is there any trade off?
For example for the RightToLeft
property I prefer myPage.FootNote.RightToLeft = true
because it's an specific attribute of each TextBlock
but MainText
could still be known as the main text of each page.
Is it better to make FootNotes
public, but MainParagraph
private? Then do I need to define a property in the Page
for every property of the MainParagraph
?