Out of my head, no guarantee of compilable code:
Code:
class CLines
{
//Index operator, both read and writeable
public string this[int Line]
{
get
{
//Return the line here
}
set
{
//Set the line here
}
}
}
class CRichTextBox
{
//Readonly property, you cannot reassign the lines object
public CLines Lines
{
get
{
return _Lines;
}
}
private CLines _Lines = new CLines();
}
var MyRichTextBox = new CRichTextBox();
//Accessing the readonly property, this is not allowed
MyRichTextBox.Lines = ...
//Accessing the read/write index operator, this is allowed
MyRichTextBox.Lines[0] = ...