Complete the code to declare a class that implements two interfaces.
interface IFirst { void MethodA(); }
interface ISecond { void MethodB(); }
class MyClass : [1] {
public void MethodA() { }
public void MethodB() { }
}Complete the code to explicitly implement the MethodA from IFirst interface.
interface IFirst { void MethodA(); }
class MyClass : IFirst {
void [1].MethodA() {
Console.WriteLine("First");
}
}Fix the error in the code by completing the interface implementation syntax.
interface IFirst { void MethodA(); }
interface ISecond { void MethodB(); }
class MyClass : IFirst [1] ISecond {
public void MethodA() { }
public void MethodB() { }
}Fill both blanks to complete the explicit implementation of two interfaces in the class.
interface IFirst { void MethodA(); }
interface ISecond { void MethodB(); }
class MyClass : IFirst, ISecond {
void [1].MethodA() {
Console.WriteLine("First");
}
void [2].MethodB() {
Console.WriteLine("Second");
}
}Fill all three blanks to create a dictionary comprehension that maps interface names to method names if method name length is greater than 5.
var methods = new Dictionary<string, string[]> {
{ "IFirst", new string[] { "MethodA", "Init" } },
{ "ISecond", new string[] { "MethodB", "Start" } }
};
var filtered = methods.ToDictionary(
[1] => [2],
[3] => [3].Value.Where(m => m.Length > 5).ToArray()
);