I have my objects like this.
public class BaseTable
{
public int ID { get; set; }
public int ParentID { get; set; }
public string Description { get; set; }
public bool IsActive { get; set; }
}
public class CarFuelType : BaseTable
{
}
and a test class
public class Test
{
public IList<CarFuelType> GetAllActiveFuelTypes()
{
var result = GetAllActiveData<CarFuelType>(LookUpTableConstants.CarFuelType);
return result.Cast<CarFuelType>().ToList();
}
private IList<T> GetAllActiveData<T>(int filter)
{
var result = from c in _lookUpTableValuesRepository.GetAllRowsWhere(l => l.ParentID == filter && l.IsActive==true)
select new BaseTable{ ID = c.ID, Description = c.Description, ParentID = c.ParentID };
return result.ToList() as IList<T>;
}
}
but I am getting null result returned from GetAllActiveData method. Is there anyway I convert IList from one type to another.