Unfortunately, no. Auto-properties are a shortcut for properties which don't have customized getters or setters.
As a side note: As Sinatr correctly mentions in the comments, you are creating a new instance of the ReadOnlyCollection on every property invocation. That is untypical for a property. Consider returning the same instance every time instead:
private IList<string> tags = new List<string>();
public IEnumerable<string> Tags { get; }
public MyClass()
{
Tags = new ReadOnlyCollection<string>(this.tags);
}
This works because ReadOnlyCollection
reflects changes made to the underlying collection:
An instance of the ReadOnlyCollection<T>
generic class is always read-only. A collection that is read-only is simply a collection with a wrapper that prevents modifying the collection; therefore, if changes are made to the underlying collection, the read-only collection reflects those changes.
Note: The constructor is required: C# does not allow field initializers to reference other instance fields, since the compiler might rearrange the initialization order. In VB.NET, where fields are initialized in the order in which they appear, this could be written as follows:
Private tagList As New List(Of String)()
Public ReadOnly Property Tags As IEnumerable(Of String) = New ReadOnlyCollection(Of String)(tagList)