6
Which interface lets a collection be initialised with { } syntax and supports Add and Count?
DiscussMedium
Loading subject content…
Loading practice questions…
Which interface lets a collection be initialised with { } syntax and supports Add and Count?
What is the output of the following program?
var d = new Duck();
Console.WriteLine(((IFly)d).Move() + ((ISwim)d).Move());
interface IFly { string Move(); }
interface ISwim { string Move(); }
class Duck : IFly, ISwim
{
string IFly.Move() => "fly";
string ISwim.Move() => "swim";
}