This error pops up when I'm trying to retrieve a value from a class object. It is after implementing the readonly keyword in a get-only property, does it show. What I understand so far is that implementing "readonly" only limits the class property to a get method. I'm not too sure about how to implement the keyword, some help please?
Here's the current code.
class Counter
{
private int _count;
private string _name;
public Counter(string name)
{
_name = name;
_count = 0;
}
public void Increment()
{
_count++;
}
public void Reset()
{
_count = 0;
}
public string Name
{
get
{
return _name;
}
set
{
_name = value;
}
}
public readonly int Value
{
get
{
return _count;
}
}
}