Exact code I'm trying to build:
public interface IMapContainer<out T> where T : MapRoomBase
{
String GetName();
IEnumerable<T> GetRooms();
}
I'm getting this error: Invalid variance: The type parameter 'T' must be invariantly valid on 'MapLibrary.IMapContainer.GetRooms()'. 'T' is covariant.
I was under the impression that this would be valid since IEnumerable simply returns the items, and none can be added. Why is this not safe + valid?
out T? Do you need thatout? - Andre Calil