User-369506445 posted
hi
when you drive List<I1> and List<I2>, in <g class="gr_ gr_8 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" id="8" data-gr-id="8">fact</g> you are <g class="gr_ gr_15 gr-alert gr_gramm gr_inline_cards
gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep" id="15" data-gr-id="15">inheritance</g> from 2 List classes that c# doesn't support Multiple inheritances, namely each class inherits from a single parent class(<g class="gr_ gr_114 gr-alert
gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del" id="114" data-gr-id="114">here</g> are 2 classes called List )
you need to use IList instead of List
class Test : IList<I1>, List<I2>
{
}
in this <g class="gr_ gr_9 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" id="9" data-gr-id="9">case</g> you have to implement the IList interface
but you can define a List of your Interface in your class
interface I1
{
int ID { get; set; }
}
interface I2
{
int AMOUNT { get; set; }
}
class Test
{
public List<I1> listL1;
public List<I2> listL2;
}