Readonly array elements

Giganews Newsgroups
Subject: Readonly array elements
Posted by:  Dom (dolivast…
Date: Tue, 20 Aug 2013

I have a class called GridCell, and I have an array of objects each declared as GridCell.  The array is ReadOonly, done like this:

private GridCell[] m_Cells;
public GridCell[] Cells {get {return m_Cells;} private set {m_Cells = value;}}

Of course, the caller can't do this:
Cells = new GridCell[9];

But I was surprised to find he can do this:
Cells[0] = new GridCell(...)

How do I prevent the latter?  BTW, I'm using arrays and not CollectionBase, because I think it is easier, simpler, and probably faster.