I have a interface class:
public interface IStatFunction : IComparable<IStatFunction>
{
}
and normal class extends IStatFunction interface:
public class StatFunction : IStatFunction
{
}
Now my code will use both of above class and interface:
public void addEffect(IStatOwner statOwner, List<IStatFunction> functions)
{
}
other code call this addEffect function:
List<StatFunction> allModifiers = null;
cgs.addEffect(item, allModifiers);
Now i get error: Cannot convert List<statfunction> to List<istatfunction>
so how can i fix this error?
What I have tried:
Im trying to use ConvertAll, its can remove error but i dont know its work or not:
cgs.addEffect(item, allModifiers.ConvertAll(o => (IStatFunction)o));