Abstract getter with concrete setter in C#
<p>I'm trying to write an abstract base class for read-only collections which implement <code>IList</code>. Such a base class should implement the set-indexer to throw a <code>NotSupportedException</code>, but leave the get-indexer as abstract. Does C# allow such a situation? Here's what I have so far:</p>

<pre><code>public abstract class ReadOnlyList : IList {

    public bool IsReadOnly { get { return true; } }

    public object this[int index] {
        get {
            // there is nothing to put here! Ideally it would be left abstract.
            throw new NotImplementedException();
        }
        set {
            throw new NotSupportedException("The collection is read-only.");
        }
    }

    // other members of IList ...
}
</code></pre>

<p>Ideally <code>ReadOnlyList</code> would be able to implement the setter but leave the getter abstract. Is there any syntax which allows this?</p>
