Why would you declare an IEnumerable<T>
readonly
?
From the this article on async & await we have the following code.
class OrderHandler
{
private readonly IEnumerable<Order> _orders;
public OrderHandler()
{
// Set orders.
}
public IEnumerable<Order> GetAllOrders()
{
return _orders;
}
}
IEnumerable<T>
is immutable. How is this different from the readonly
keyword?