Hello,
I have following code
public interface IEntity
{
int Id { get; set; }
}
public interface ICriteria<T> where T : class,IEntity
{
T GetResult(int id);
}
public class DummEntity : IEntity
{
public int Id { get; set; }
}
public class SimpleCriteria<T>:ICriteria<T> where T:class,IEntity
{
public T GetResult(int id)
{
return default(T);
}
}
should this type casting work ?
SimpleCriteria<DummEntity> scr = new SimpleCriteria<DummEntity>();
ICriteria<IEntity> generic = (ICriteria<IEntity>)scr;