I have a class which contains a HashTable
field. How I need to implement get
and set
methods for exclusive writing to HashTable
, but non-exclusive reading?
private Hashtable _data = new Hashtable();
public object this[object key]
{
get {} // must be non-exclusive
set {} // must be exclusive
}
I need my own implementation of getter and setter. Without any additional framework helpers (I asked this question on interview).