Working on a big project, I realized the following snippet :
public interface Mother
{
void CoolFeature();
}
public interface Daughter : Mother
{
}
public class YouJustLostTheGame<T> : List<T> where T : Mother
{
public void Crowd(Mother item)
{
this.Add(item);
}
public void useFeature()
{
this.Find(a => { return true; }).CoolFeature();
}
}
fails to compile the Crowd(Mother)
function with the message "Unable to convert 'Test.Mother' to 'T'".
Of course this seems deeply wrong to me, and the useFeature()
is perfectly fine.
So what am I missing ?
N.B: VS2012, win7 x64, .NET 4.5